Hi,
I was searching for a way to use 'regular' queueing in nameko.
It makes sense to have one service for sending mail. Using RPC from other
services to this mailer service is possible but let's say i don't need the
response, so why wait for an answer right? Here are a few options that came
to mind:
a) call the rpc using async and 'forget' about the response
b) use RPC to call a function in the mailsender that will drop an event to
itself and return (nearly) instantly and let nameko handle the event to be
picked up asynchronously - but it's quite an overload considering it to be
a workaround for simple queueing.
c) use nameko.standalone.events.event_dispatcher and drop it right where i
want the event to go, but then I lose all the beauty the
providers/extensions and the mocks and testing those provide.
What would be the preferred way to go about this from namekos philosophy?
Tried something like but had no luck whatsoever.:
from nameko.messaging import Publisher, consume
from kombu import Exchange, Queue
ew_exchange = Exchange('ew_messenger',)
ew_sendmail_queue =
Queue('mailqueue',exchange=ew_exchange,routing_key='sendmail')
class someservice(object):
name='some'
send_mail = Publisher(exchange=ew_exchange, queue=ew_sendmail_queue)
def ...
self.send_mail(msg)
class mailsender(object):
name='mailsender'
@event_handler('ew_messenger','mailqueue')
def foo():
# ...
Clarity is greatly appreciated.
Thanks,
Remco Boerma