示例#1
0
 def setup_first_links(self, event):
     self.first_sender = event.container.create_sender(self.first_conn, self.first_address)
     if self.dynamic:
         self.first_receiver = event.container.create_receiver(self.first_conn,
                                                               dynamic=True,
                                                               options=DynamicNodeProperties({"x-opt-qd.address":
                                                                                              UNICODE(self.first_address)}))
     else:
         self.first_receiver = event.container.create_receiver(self.first_conn, self.first_address)
示例#2
0
 def on_connection_opened(self, event):
     if event.connection == self.conn_route:
         self.conn_normal = event.container.connect(self.normal_addr)
     elif event.connection == self.conn_normal:
         self.receiver = event.container.create_receiver(
             self.conn_normal,
             None,
             dynamic=True,
             options=DynamicNodeProperties(
                 {"x-opt-qd.address": u"pulp.task.abc"}))
示例#3
0
 def receiver(self, address=None, dynamic=False):
     """
     Get a message receiver for the specified address.
     :param address: An AMQP address.
     :type address: str
     :param dynamic: Indicates link address is dynamically assigned.
     :type dynamic: bool
     :return: A receiver.
     :rtype: proton.utils.BlockingReceiver
     """
     options = None
     name = str(uuid4())
     if dynamic:
         # needed by dispatch router
         options = DynamicNodeProperties({'x-opt-qd.address': str(address)})
         address = None
     return self._impl.create_receiver(address,
                                       name=name,
                                       dynamic=dynamic,
                                       options=options)
示例#4
0
 def on_connection_opened(self, event):
     if event.connection == self.conn_route:
         self.conn_normal = event.container.connect(self.normal_addr)
     elif event.connection == self.conn_normal:
         self.sender = event.container.create_sender(self.conn_normal, None, options=\
                                                     [DynamicTarget(), DynamicNodeProperties({"x-opt-qd.address":u"pulp.task.abc"})])