I have a rabbitMQ queue.
The consumer of this queue is an application that pulls messages off the queue, and inserts them into a database (after some processing).
I want to also be able to use these messages for something else (to send them to another application for storage and other, unrelated processing).
The consumer application is closed source, so I can't open it up and change its behaviour.
I think the best way of achieving my goal would be to mirror the rabbit queue, and consuming it independently (and without interfering) of the original message flow.
I've looked at RabbitMQ mirroring, but this seems to be designed to operate on two or more nodes in a master/slave configuration.
What I think I want is:
Pre-processor application > rabbit_queue_1 > Normal DB consumer
\
> rabbit_queue_2 > New independent consumer.
I need both consumers to get all the same messages, so I dont want two applications reading from the same queue, or for a new consumer to read off the queue then put back on to it again.
Mirroring is a high-availability solution and is inappropriate for what you are asking.
Instead, consider that RabbitMQ splits the publishing and consuming functions. If the existing program is publishing to RabbitMQ, simply figure out the routing key of the current application's queue, and use that in declaring your own queue.
Messages published, when matching the routing key, will flow to all queues using that key. Special cases include fanout/topic exchanges, which additionally permit wildcards in routing keys.
Using a direct exchange, your topology is actually:
Pre-processor application > Direct exchange > rabbit_queue_1 > Normal DB consumer
(via routing key) \
> rabbit_queue_2 > New independent consumer.