Exemple #1
0
 def __init__(self, url, timeout):
     MessagingHandler.__init__(self)
     Thread.__init__(self)
     self.daemon = True
     self.timeout = timeout
     self.url = url
     self.senders = {}
     self.container = None
     self.event = Event()
    def __init__(self, connector: Connector) -> None:
        """
        Base class acting a MessagingHandler to a `proton.Container`. Any custom handler should inherit from this class.

        :param connector: takes care of the connection .i.e TSL, SASL etc
        """
        MessagingHandler.__init__(self)

        self.connector = connector
        self.started = False
        self.container = None
        self.conn = None
Exemple #3
0
 def __init__(self, backend, host, port, channel, options=None):
     MessagingHandler.__init__(self)
     self.backend = backend
     self.host = host
     self.port = port
     self.channel = channel
     self.container = Container(self)
     self.connection = self.container.connect(self.address)
     self.receiver = self.container\
         .create_receiver(self.connection, self.channel, options=options)
     self.seen = collections.deque([], 2000)
     self.receiver_id = uuid.uuid4().hex
     threading.Thread.__init__(self, target=self.container.run, daemon=True)
 def __init__(self, backend, host, port, channel, options=None):
     MessagingHandler.__init__(self)
     self.backend = backend
     self.host = host
     self.port = port
     self.channel = channel
     self.container = Container(self)
     self.connection = self.container.connect(self.address)
     self.receiver = self.container\
         .create_receiver(self.connection, self.channel, options=options)
     self.seen = collections.deque([], 2000)
     self.receiver_id = uuid.uuid4().hex
     threading.Thread.__init__(self, target=self.container.run, daemon=True)
 def __init__(self, backend, host, port, channel):
     MessagingHandler.__init__(self)
     self.backend = backend
     self.host = host
     self.port = port
     self.channel = channel
     self.container = Container(self)
     self.connection = self.container.connect(self.address)
     self.sender = self.container.create_sender(self.connection, self.channel)
     self.events = {}
     self.lock = threading.RLock()
     threading.Thread.__init__(self, target=self.container.run, daemon=True)
     self._event_started = threading.Event()
 def __init__(self, backend, host, port, channel):
     MessagingHandler.__init__(self)
     self.backend = backend
     self.host = host
     self.port = port
     self.channel = channel
     self.container = Container(self)
     self.connection = self.container.connect(self.address)
     self.sender = self.container.create_sender(self.connection,
                                                self.channel)
     self.events = {}
     self.lock = threading.RLock()
     threading.Thread.__init__(self, target=self.container.run, daemon=True)
     self._event_started = threading.Event()
    def __init__(self, topic_name: str, data_handler: Callable,
                 interval_in_sec: int, **kwargs) -> None:
        """
        A topic to be run upon interval periods.
        It inherits from `proton.MessagingHandler` in order to take advantage of its event scheduling functionality

        :param interval_in_sec:
        """
        MessagingHandler.__init__(self)
        Topic.__init__(self, topic_name, data_handler)

        self.interval_in_sec = interval_in_sec

        # a callback to be set from the broker handler upon first scheduling
        self._message_send_callback: Optional[Callable] = None
Exemple #8
0
    def __init__(self):
        XqaMessagingHandler.__init__(self)
        MessagingHandler.__init__(self)
        self._stopping = False
        self._uuid = str(uuid4()).split('-')[0]
        self._service_id = '%s/%s' % (self.__class__.__name__.lower(),
                                      self._uuid)
        self._insert_uuid = '%s.%s' % (
            configuration.message_broker_shard_insert_uuid_queue, self._uuid)

        logging.info(self._service_id)
        logging.debug('-message_broker_host=%s' %
                      configuration.message_broker_host)
        logging.debug('-configuration.storage_mainmem=%s' %
                      configuration.storage_mainmem)

        self._storage_service = StorageService()
    def __init__(self, addr):
        Thread.__init__(self)
        MessagingHandler.__init__(self)

        self.addr = addr
        self.response = None  # Response message
        self.senders = {}
        self.listening = False

        self.disconnect = Queue(0)  # Disconnect requests
        self.disconnected = Queue(0)  # Disconnects executed

        # Start listener and server thread
        self.container = Container(self)
        self.container.start()
        while not self.listening and self.container.process():
            pass
        self.start()
Exemple #10
0
    def __init__(self, addr):
        Thread.__init__(self)
        MessagingHandler.__init__(self)

        self.addr = addr
        self.response = None       # Response message
        self.senders = {}
        self.listening = False

        self.disconnect = Queue(0) # Disconnect requests
        self.disconnected = Queue(0) # Disconnects executed

        # Start listener and server thread
        self.container = Container(self)
        self.container.start()
        while not self.listening and self.container.process():
            pass
        self.start()
Exemple #11
0
 def on_transport_error(self, event):
     print("Transport error:", event.transport.condition)
     MessagingHandler.on_transport_error(self, event)
Exemple #12
0
 def on_transport_error(self, event):
     print("transport failure for borker:", self.url)
     MessagingHandler.on_transport_error(self, event)
Exemple #13
0
 def on_transport_error(self, event):
     print("Transport failure for amqp broker:", self.url, "Error:", event.transport.condition)
     MessagingHandler.on_transport_error(self, event)