On 07/11/2019 10:47 pm, Louis Letourneau wrote:
I am using qpid proton 0.29 python talking to Active MQ using AMQP 1.0

I am trying to use one container and send messages to multiple queues

     def on_start(self, event):
         conn_url1 = Url(...)
         self.sender1 = event.container.create_sender(conn_url1)
         conn_url2 = Url(...)
         self.sender2 = event.container.create_sender(conn_url2)

     def on_new_data(self, event):
         msg = Message(body=event.subject)
         print('{}, {}'.format(self.sender1.credit, self.sender2.credit))
         if(self.sender1.credit > 0):
             self.sender1.send(msg)
         else:
             print("No credits: sender1")
         if(self.sender2.credit > 0):
             self.sender2.send(msg)
         else:
             print("No credits: sender2")


Problem is, sender2 always has 0 credits.
If I create X senders, only the first one created will have credits the
others will always be 0

I only found 2 ways to make this work.
1- Not use containers, but use a BlockingConnection per sender
2- Create one container per sender. Which means many loops, basically one
per connection

Is this normal? Why can't a container manage multiple connections/senders?

It may be that it is only accepting the first connection with the same container id (treating it as the client id in JMS terms).

try:

event.container.container_id = None

before opening any connection (in which case they should each get a different uuid), or else setting it to a different value of your choosing before opening each connection.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to