On 12/11/18 20:07, gsupa wrote:
Hi All,I'm working on migrating a python2 app to python3, which also means transitioning to Proton. The application is communicating with a c++ qpid broker. *One of the last roadblocks I'm having in this transition is figuring out how to dynamically generate a queue with bindings hooked up.* The current application will create a queue with x-declare and x-bindings, and can scale with more consumers. These new consumers will connect to this existing queue (or create if it does not exist) and messages on this queue will be distributed across these consumers. Additionally, if there are no consumers, the queue will be automatically deleted, and messages sent to the exchange will be routed to an alternate exchange. Old usage: { create: always, node: { type: queue, durable: False, x-declare: { exclusive: False, auto-delete: True, alternate-exchange: e_fed_example }, x-bindings: [ { exchange: 'e_example' } ] }, link: { durable: False } } (The actual exchange e_example also has alternate-exchange defined) Some possible solutions I've evaluated: 1) I could dynamically create a receiver on the exchange for each consumer, but this would mean messages duplicated to all consumers, instead of being distributed. 2) The broker has an option for queues with a certain pattern to be created on demand. This allows our consumers to connect to the same queue, and the queue will auto-delete if all consumers disconnect (allowing for the alternate exchange on the exchange to kick in). However, the queue is not bound to an exchange, which isn't helpful.
You can also define a 'topic', which is basically an exchange and the queue settings to be used for subscriptions to it.
3) I've seen a c++ example which utilizes 'shared' 'capabilities' when creating a connection which would theoretically allow new receivers to connect to the same queue, but I haven't seen any documentation on this for Python.
https://github.com/grs/amqp_subscriptions/blob/master/e.py#L41 is an example of specifying a shared capability (it uses a small utility class which is also in that repo).
--------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
