dougbarth / amqp-utils

Command line utils for interacting with an AMQP based queue
MIT License
78 stars 11 forks source link

allow piping from amqp-dequeue into amqp-enqueue #1

Open iragsdale opened 14 years ago

iragsdale commented 14 years ago

These are already super useful, but it would be awesome if we could pipe the output from amqp-dequeue into amqp-enqueue, which would make it a great utility for ad-hoc transfer of messages from one queue to another.

A simple way to enable this would be to allow JSON or YAML output from amqp-dequeue, and allow amqp-enqueue to read the message from stdin as JSON or YAML. That would enable something like the following:

amqp-dequeue --format json old_queue | amqp-enqueue --format json new_queue -

That would let you move messages around in queues extremely easily.

iragsdale commented 14 years ago

If this is a capability you'd be interested in having, I'd be happy to whip up a patch.

dougbarth commented 13 years ago

Man, this has sat for almost a year without a comment from me. Sorry about that.

I took a swag at trying to implement this a while back. I ran into issues with EventMachine and reading from STDIN. At the time, I was trying to read from STDIN in an evented fashion so that piped output from amqp-dequeue output doesn't just end up queueing up in memory for the amqp-enqueue command before getting flushed out to the server.

My plan at the time was to move away from a fully evented style and instead run the EM reactor on a background thread. That's a bit of a larger effort, so if you work up a patch that works but has the downside of queueing all messages in memory before sending them to the server, I'll accept that and use it as motivation to rework the EM management.

LuboVarga commented 8 years ago

I also miss this feature/possibility.