Skip to content

Commit

Permalink
Document how to send messages to the mgmt interface of the Worker
Browse files Browse the repository at this point in the history
  • Loading branch information
dnaeon committed Jan 8, 2014
1 parent a57fe9e commit 8b1701c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/vpoller/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,15 +289,27 @@ def process_mgmt_message(self, msg):
"""
Processes a message for the management interface
Example client message to shutdown the vPoller Worker would be:
{
"cmd": "shutdown"
}
Getting status information from the vPoller worker:
{
"cmd": "status"
}
"""
# Check if we have a command to process
if not "cmd" in msg:
return "{ \"success\": -1, \"msg\": \"Missing command name\" }"

if msg["cmd"] == "shutdown":
self.time_to_die = True
logging.info("VPoller Worker is shutting down")
return "{ \"success\": 0, \"msg\": \"Shutting down VPoller Worker\" }"
logging.info("vPoller Worker is shutting down")
return "{ \"success\": 0, \"msg\": \"vPoller Worker is shutting down\" }"
elif msg["cmd"] == "status":
return "{ \"success\": 0, \"msg\": \"Okay, this is the status\" }"
else:
Expand Down

0 comments on commit 8b1701c

Please sign in to comment.