From 452aba0373f34e76ac39596392e0901f7379ae63 Mon Sep 17 00:00:00 2001 From: Lubos Kocman Date: Tue, 4 Oct 2016 15:00:19 +0200 Subject: [PATCH] messaging: publish*, unify order of args, remove positional arg --- rida/messaging.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/rida/messaging.py b/rida/messaging.py index f98db0c3..b7e526f2 100644 --- a/rida/messaging.py +++ b/rida/messaging.py @@ -225,7 +225,7 @@ class RidaModule(BaseMessage): self.module_build_state = module_build_state -def publish(topic, msg, conf, service='rida'): +def publish(topic, msg, conf, service): """ Publish a single message to a given backend, and return :param topic: the topic of the message (e.g. module.state.change) @@ -238,7 +238,7 @@ def publish(topic, msg, conf, service='rida'): handler = _messaging_backends[conf.messaging]['publish'] except KeyError: raise KeyError("No messaging backend found for %r" % conf.messaging) - return handler(topic, msg, service=service) + return handler(topic, msg, conf, service) def listen(conf, **kwargs): @@ -257,7 +257,8 @@ def listen(conf, **kwargs): yield event -def _fedmsg_publish(conf, topic, msg, service): +def _fedmsg_publish(topic, msg, conf, service): + # fedmsg doesn't really need access to conf, however other backends do import fedmsg return fedmsg.publish(topic, msg=msg, modname=service) @@ -314,7 +315,7 @@ def _amq_listen(conf, **kwargs): if msg_obj: yield msg_obj -def _amq_publish(conf, topic, msg, service): +def _amq_publish(topic, msg, conf, service): import proton msngr = _amq_get_messenger(conf) message = proton.Message()