Hello,
I just upgraded to 2.3.1 and need to override the broadcast_identifier for
reliable broadcast delivery as we have some broadcasted events which we
need to be reliable.
Any hints on how to override the broadcast_identifier? I looked at the code
and see the property, just clueless on how to actually override it.
Thanks,
Conor
Just create a subclass and use that:
# myapp/entrypoints.py
import socket from nameko.events import EventHandler as NamekoEventHandler
class EventHandler(NamekoEventHandler):
""" EventHandler that uses `socket.gethostname` as its broadcast identifier """
@property
def broadcast_identifier(self):
return socket.gethostname()
event_handler = EventHandler.decorator
# service.py (no different apart from the imports)
from myapp.entrypoints import event_handler
class MyService(object):
name = "myservice"
@event_handler("src_service", "event_type", handler_type=BROADCAST)
def handle(self, event_data):
pass
Using subclasses is the generally encouraged way to extend nameko, and I
will update the docs to that effect when I get a chance.
···
On Thursday, May 12, 2016 at 8:02:34 PM UTC+1, Conor Seabrook wrote:
Hello,
I just upgraded to 2.3.1 and need to override the broadcast_identifier for
reliable broadcast delivery as we have some broadcasted events which we
need to be reliable.
Any hints on how to override the broadcast_identifier? I looked at the
code and see the property, just clueless on how to actually override it.
Thanks,
Conor