hutch icon indicating copy to clipboard operation
hutch copied to clipboard

Handle returned messages

Open jesjos opened this issue 8 years ago • 0 comments

Currently, as far as I understand, if a Producer publishes a message and no Consumer is available to consume it, that message is dropped without trace. This is because no queue is bound to the routing key yet.

I would like to have the option to notify the Producer, for example by raising an error.

It seems like the mandatory option when publishing is what we want.

I know how to send this option:

Hutch.publish('foo', 'bar', mandatory: true)

But currently this produces no new behavior as there is no handler registered for returned messages.

The challenge is how to implement this handling, since message seem to be returned asynchronously. I'm guessing it would be hard (impossible?) to have Hutch.publish block until we now the message has been routed. Perhaps we could be content with logging the returned message as a warning.

Any input on this? Alternative methods of achieving the same result?

jesjos avatar Feb 09 '16 06:02 jesjos