I'm building a system using RabbitMQ. One of the things I want to be able to do is direct log messages to different queues based on the severity of the message that's being logged. Errors and exceptions should go to one queue for immediate handling; less-important messages like Trace logs should go somewhere else, so they don't clog up critical logging.
The way I thought to handle this is to set up a Topic exchange and bind two queues to the exchange. Then, my log messages will use their log level in the routing key to get sent to the right queue. However, I have a problem where I don't know the best way to set up the routing keys.
Getting my errors into the right queue is easy - bind two queues to the exchange, one with an Error
routing key, and then messages with an Error
routing key get sent to it. I want every other kind of message sent to this exchange to go to the other queue. But I don't think you can describe a routing key like !Error
or something, or at least it doesn't appear in the RabbitMQ tutorials or the AMQP spec that I can see. If I use a wildcard binding, then my error messages get delivered to both queues.
It looks like I can accomplish this by using an Alternate Exchange (http://www.rabbitmq.com/ae.html) But I would rather stick with straight AMQP if possible, and configuring AEs adds another layer of complexity to my system initialization.
I could also define routing keys for every log level in my system, and explicitly route everything that isn't Error
to the low-level queue. But that seems excessively verbose and adds maintenance overhead.
Is there a better way to accomplish my goal than using an AE?