Exemple #1
0
    def _queueOutgoingDeliveries(self, conn):
        for ssn in self._iterSessions(conn, proton.PN_LOCAL_ACTIVE):
            ctx = proton.pn_session_get_context(ssn)
            sender = ctx.sender

            if sender is None:
                # No sender link
                sender = proton.pn_sender(ctx.session,
                                          "sender-%s" % str(uuid.uuid4()))
                ctx.sender = sender
                continue

            while proton.pn_link_credit(sender) > 0:
                try:
                    data = ctx._popPendingMessage()
                except Empty:
                    break
                else:
                    msg = proton.Message()
                    msg.body = data
                    d = proton.pn_delivery(sender,
                                           "delivery-%s" % str(uuid.uuid4()))

                    proton.pn_delivery_set_context(d, msg.encode())
                    self.log.debug("Queueing delivery (%s)",
                                   proton.pn_delivery_tag(d))
Exemple #2
0
    def _queueOutgoingDeliveries(self, conn):
        for ssn in self._iterSessions(conn, proton.PN_LOCAL_ACTIVE):
            ctx = proton.pn_session_get_context(ssn)
            sender = ctx.sender

            if sender is None:
                # No sender link
                sender = proton.pn_sender(ctx.session,
                                          "sender-%s" % str(uuid.uuid4()))
                ctx.sender = sender
                continue

            while proton.pn_link_credit(sender) > 0:
                try:
                    data = ctx._popPendingMessage()
                except Empty:
                    break
                else:
                    msg = proton.Message()
                    msg.body = data
                    d = proton.pn_delivery(sender,
                                           "delivery-%s" % str(uuid.uuid4()))

                    proton.pn_delivery_set_context(d, msg.encode())
                    self.log.debug("Queueing delivery (%s)",
                                   proton.pn_delivery_tag(d))
Exemple #3
0
 def _processOutgoing(self, delivery):
     link = proton.pn_delivery_link(delivery)
     msg = proton.pn_delivery_get_context(delivery)
     proton.pn_link_send(link, msg)
     if proton.pn_link_advance(link):
         self.log.debug("Delivery finished (%s)",
                        proton.pn_delivery_tag(delivery))
         proton.pn_delivery_set_context(delivery, time.time())
Exemple #4
0
 def _processOutgoing(self, delivery):
     link = proton.pn_delivery_link(delivery)
     msg = proton.pn_delivery_get_context(delivery)
     proton.pn_link_send(link, msg)
     if proton.pn_link_advance(link):
         self.log.debug("Delivery finished (%s)",
                        proton.pn_delivery_tag(delivery))
         proton.pn_delivery_set_context(delivery, time.time())
Exemple #5
0
 def _processOutgoing(self, delivery):
     link = proton.pn_delivery_link(delivery)
     msg = proton.pn_link_get_context(link)
     sent = proton.pn_link_send(link, msg)
     if sent < 0:
         self.log.warn("Problem sending message")
     else:
         msg = msg[sent:]
         if len(msg) != 0:
             self.log.debug("Delivery partial")
             proton.pn_link_set_context(link, msg)
         else:
             self.log.debug("Delivery finished")
             proton.pn_link_set_context(link, "")
             proton.pn_delivery_set_context(delivery, time.time())
             proton.pn_link_advance(link)