def __init__(self, xp_name=None, event_type=None, origin=None, queue_name=None, callback=None, sub_type=None, origin_type=None, pattern=None, auto_delete=None, *args, **kwargs): """ Initializer. If the queue_name is specified here, the sysname is prefixed automatically to it. This is because named queues are not namespaces to their exchanges, so two different systems on the same broker can cross-pollute messages if a named queue is used. Note: an EventSubscriber needs to be closed to free broker resources """ self._cbthread = None # sets self._ev_recv_name, self.binding BaseEventSubscriberMixin.__init__(self, xp_name=xp_name, event_type=event_type, origin=origin, queue_name=queue_name, sub_type=sub_type, origin_type=origin_type, pattern=pattern, auto_delete=auto_delete) log.debug("EventPublisher events pattern %s", self.binding) from_name = self._get_from_name() binding = self._get_binding() Subscriber.__init__(self, from_name=from_name, binding=binding, callback=callback, auto_delete=self._auto_delete, **kwargs)
def __init__(self, callback=None, pattern='#', *args, **kwargs): """ Note: a ConversationSubscriber needs to be closed to free broker resources """ self._cbthread = None self.binding = pattern log.debug("ConversationSubscriber pattern %s", self.binding) Subscriber.__init__(self, binding=self.binding, callback=callback, **kwargs)
def __init__(self, xp_name=None, event_type=None, origin=None, queue_name=None, callback=None, sub_type=None, origin_type=None, *args, **kwargs): """ Initializer. If the queue_name is specified here, the sysname is prefixed automatically to it. This is because named queues are not namespaces to their exchanges, so two different systems on the same broker can cross-pollute messages if a named queue is used. Note: an EventSubscriber needs to be closed to free broker resources """ self.callback = callback self._cbthread = None self.event_type = event_type self.sub_type = sub_type self.origin_type = origin_type self.origin = origin xp_name = xp_name or get_events_exchange_point() binding = self._topic(event_type, origin, sub_type, origin_type) self.binding = binding # TODO: Provide a case where we can have multiple bindings (e.g. different event_types) # prefix the queue_name, if specified, with the sysname # this is because queue names transcend xp boundaries (see R1 OOIION-477) if queue_name is not None: if not queue_name.startswith(bootstrap.get_sys_name()): queue_name = "%s.%s" % (bootstrap.get_sys_name(), queue_name) log.warn( "queue_name specified, prepending sys_name to it: %s" % queue_name) name = (xp_name, queue_name) log.debug("EventPublisher events pattern %s", binding) Subscriber.__init__(self, from_name=name, binding=binding, callback=self._callback, **kwargs)
def __init__(self, xp_name=None, event_name=None, origin=None, queue_name=None, callback=None, *args, **kwargs): """ Initializer. If the queue_name is specified here, the sysname is prefixed automatically to it. This is becuase named queues are not namespaces to their exchanges, so two different systems on the same broker can cross-pollute messages if a named queue is used. """ self._event_name = event_name or self.event_name xp_name = xp_name or get_events_exchange_point() binding = self._topic(origin) # prefix the queue_name, if specified, with the sysname # this is because queue names transcend xp boundaries (see R1 OOIION-477) if queue_name is not None: if not queue_name.startswith(bootstrap.sys_name): queue_name = "%s.%s" % (bootstrap.sys_name, queue_name) log.warn("queue_name specified, prepending sys_name to it: %s" % queue_name) name = (xp_name, queue_name) Subscriber.__init__(self, name=name, binding=binding, callback=callback, **kwargs)
def __init__(self, xp_name=None, event_type=None, origin=None, queue_name=None, callback=None, sub_type=None, origin_type=None, *args, **kwargs): """ Initializer. If the queue_name is specified here, the sysname is prefixed automatically to it. This is because named queues are not namespaces to their exchanges, so two different systems on the same broker can cross-pollute messages if a named queue is used. Note: an EventSubscriber needs to be closed to free broker resources """ self.callback = callback self._cbthread = None self.event_type = event_type self.sub_type = sub_type self.origin_type = origin_type self.origin = origin xp_name = xp_name or get_events_exchange_point() binding = self._topic(event_type, origin, sub_type, origin_type) self.binding = binding # TODO: Provide a case where we can have multiple bindings (e.g. different event_types) # prefix the queue_name, if specified, with the sysname # this is because queue names transcend xp boundaries (see R1 OOIION-477) if queue_name is not None: if not queue_name.startswith(bootstrap.get_sys_name()): queue_name = "%s.%s" % (bootstrap.get_sys_name(), queue_name) log.warn("queue_name specified, prepending sys_name to it: %s" % queue_name) name = (xp_name, queue_name) log.debug("EventPublisher events pattern %s", binding) Subscriber.__init__(self, from_name=name, binding=binding, callback=self._callback, **kwargs)
def __init__(self, process=None, **kwargs): self._process = process Subscriber.__init__(self, **kwargs)
def __init__(self, process=None, routing_call=None, **kwargs): assert process self._process = process self._routing_call = routing_call Subscriber.__init__(self, **kwargs)
def __init__(self, queue_name, callback, **kwargs): self.callback = callback Subscriber.__init__(self, from_name=queue_name, callback=callback, **kwargs)