Listeners

pymco.listeners

stomp.py listeners for python-mcollective.

class pymco.listener.CurrentHostPortListener(*args, **kwargs)[source]

Listener tracking current host and port.

Some connectors, like ActiveMQ connector, may provide different user and password for each host, so we need track the current host and port in order to be able to get the right user and password when logging.

get_host()[source]

Return current host.

Returns:current host.
get_port()[source]

Return current host.

Returns:current port.
on_connecting(host_and_port)[source]

Track current host and port.

Parameters:host_and_port – A two-tuple with host as first element and port as the second.
class pymco.listener.ResponseListener(config, connector, count, timeout=30, condition=None, logger=<logging.Logger object>)[source]

Listener that waits for a message response.

Parameters:
  • configpymco.config.Config instance.
  • count – number of expected messages.
  • timeout – seconds we should wait for messages.
  • condition – by default a threading.Condition object for synchronization purposes, but you can use any object implementing the wait() method and accepting a timeout argument.
on_message(headers, body)[source]

Received messages hook.

Parameters:
  • headers – message headers.
  • body – message body.
security

Security provider property

wait_on_message()[source]

Wait until we get a message.

Returns:self.