Description
Description
We use header based queues and exchanges to keep track of events. The majority of these queues have multiple bindings so we can listen to an update event on one model and a creation event on another model in the same queue. Adding a few lines of code to Connection.php in amqp-messenger will allow Symfony Messenger to support this type of queue. This is pretty standard in other amqp library implementations.
Example
Some small refactoring here would be ideal because this was not designed with header exchanges or queues in mind at all. To maintain backwards compatibility we should probably introduce a new option under queues[name], 'bindings[name]'. This would then allow any number of arrays with a 'key' string value, another 'arguments' array value, and possibly an 'exchange' value to support multiple exchanges. After this, the older way of specifying bindings should probably be deprecated.
async_consume_task:
dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
options:
vhost: message-bus
exchange:
name: message-bus-exchange
type: headers
queues:
'cart-purchases-header-queue':
'bindings':
'manual-messages':
'arguments':
message-type: 'task'
subject: 'cart'
x-bind: all
'customer-messages':
'arguments':
message-type: 'event'
subject: 'customer'
x-bind: all
'general-events-topic-queue':
'bindings':
0:
'key': 'entity-change.*.*.*'