ruby-amqp / hutch

A system for processing messages from RabbitMQ.
https://gocardless.com/blog/hutch-inter-service-communication-with-rabbitmq/
MIT License
855 stars 137 forks source link

Make RabbitMQ exchange type configurable #349

Closed bumi closed 4 years ago

bumi commented 4 years ago

This changes makes the exchange type configurable with a default to use a topic exchange. This is done simply by declaring the exchange through a different Bunny API: not using the channel.topic() shortcut but initializing a new Bunny::Exchange.new()

Though Hutch is opinionated on the exchange/message types used. (which is good!) this makes it possible to for example use Hutch in combination with the delayed message exchange RabbitMQ plugin which defines a new exchange type but can act like a topic exchange.

Example usage:

Hutch::Config.set(:mq_exchange_type, 'x-delayed-message')
Hutch::Config.set(:mq_exchange_options, { arguments: { 'x-delayed-type': 'topic' } })

I don't know much about RabbitMQ internals and the internals of the RabbitMQ plugins but considering this minor change I thought it is worth to consider it?

michaelklishin commented 4 years ago

This feature is of limited use right now but indeed it can work with the delayed message exchange and its subsequent replacement. So let's get it into 1.0.