AirHelp / rabbit-amazon-forwarder

RabbitMQ forwader to Amazon services

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple routing keys

adamlc opened this issue Β· comments

Hey guys! It would be really handy if we could specify multiple routing keys πŸ‘

Hi, would have time to make a PR for it? According to RabbitMQ docs, this could be achieved like this:

for severity in severities:
    channel.queue_bind(exchange='direct_logs',
                       queue=queue_name,
                       routing_key=severity)

(https://www.rabbitmq.com/tutorials/tutorial-four-python.html).
So in the code, apart from switching from string to list in routing key, you would have to iterate over the list in this method: https://github.com/AirHelp/rabbit-amazon-forwarder/blob/master/rabbitmq/consumer.go#L109. I can write some tests for that piece of code :)

Yeah, it should be as simple as adding a few extra queue binds in a loop like you've mentioned.

I guess the next thing to consider is how do we specify in the mapping file? At the moment routing is a string. Changing that to an array will obviously be a breaking change. Do we add a new option or make a breaking change?

I guess we could make RoutingKey a generic interface{} and check if its a string or []string as a possible solution?

Breaking change is not possible at the moment, as this is used on production. routingKeys could be added as an extra filed to json imho.

Makes sense! I'll have a stab at this sometime πŸ‘