Editing
Cfengine3 Messaging
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Information processing Nodes == Information processing Nodes receive their information through message feeds and for their part may be willing to share their information through views. Data would be an information processing Node, relying on a defined set of feeds, an information processing process that builds the Universal Truth and defined autorized views that share the information stored. === cf-messaged === In this proof of concept the listener simply adds every message to a file, queue.txt as were it a queue. Nodes in fect feed the listener with information and the listener knows how to process incoming messages. Feeds are input schemas. The example uses the typical Zeromq port 5555, but why would we not use a more typical CFEngine port 5309? <pre> import time import zmq context = zmq.Context() socket = context.socket(zmq.REP) socket.bind("tcp://10.68.71.184:5555") response = "message received" while True: # Wait for next request from client message = socket.recv() print("Received request: %s " % message) # Do some 'work' time.sleep(1) with open("queue.txt", "a") as queue: queue.write(message + "\n") # Send reply back to client socket.send( response ) </pre> The output would be: <pre> root@wbhs-pkg:~# tail -F queue.txt {host:{uqhost:x2gvdt0001,domain:webhuis.nl,role:x2gvdt}} {host:{uqhost:kvmutl0004,domain:webhuis.nl,role:kvmutl}} {host:{uqhost:x2gvdt0001,domain:webhuis.nl,role:x2gvdt}} {host:{uqhost:x2gvdt0001,domain:webhuis.nl,role:x2gvdt}} </pre> When a message is received the daemon places the message in a local queue for processing. The sending node receives a hard coded response "message received", but this could be any response as a result on the side of the listener. The response is useful when it triggers the node to supply more information in more messages.
Summary:
Please note that all contributions to Webhuis wiki are considered to be released under the GNU Free Documentation License 1.3 or later (see
Project:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Voorpagina
Cobol and PostgreSQL
PostgreSQL
CFEngine
Proxmox
Webhuis Kennisbank
Basale infra
Webhuis bouwstenen
Webhuis configuratie
Webhuis Infra
Webhuis Support
Webhuis Raspberry
Opzet Applicaties
Business Applicaties
Community portal
Current events
Recent changes
Random page
Help
sitesupport
Tools
What links here
Related changes
Special pages
Page information