ricbra / rabbitmq-cli-consumer

Consume RabbitMQ messages into any cli program
MIT License
247 stars 49 forks source link

Setting requeue=false #12

Closed mbiagetti closed 8 years ago

mbiagetti commented 9 years ago

Hi, I'm consuming my rabbitmq message with this (very useful!) client. I'm going to implement a Dead Letter Exchanges mechanism as described here. In particular i want to know if is possible to configure the client with the second scenario described:

The message is rejected (basic.reject or basic.nack) with requeue=false,

How can i implements this features?

Thanks in advice Matteo

ricbra commented 9 years ago

Hi @mbiagetti ,

Nice to hear you're using my client and thanks for reporting this issue.

Two things need to be changed to get this working:

So I'l have to think of some new configuration settings and implement this feature.

mbiagetti commented 9 years ago

Hi @ricbra ! Thanks for your response. At the moment I'm investigate howto integrate RabbitMq in our LAMP/Symfony2 application. We actually integrate RabbitMqBundle for send message. And for simplify our life, we adopt you simple and (very) useful client!

Yes without this fix i can't consume message from a queue declared with this config:

    fleet_report:
        connection:       default
        exchange_options: {name: 'fleet_report', type: direct}
        queue_options:    {name: 'fleet_report', arguments: {'x-message-ttl': ['I', 5000],'x-dead-letter-exchange': ['S', 'error-exchange']}}

I gave the error:

Failed creating consumer: Failed to declare queue: Exception (406) Reason: "PRECONDITION_FAILED - inequivalent arg 'x-message-ttl' for queue 'fleet_report' in vhost '/': received none but current is the value '5000' of type 'signedint'"

I'm not a go language developer but let me know how and if I can help you!

LouTerrailloune commented 9 years ago

You can may be use the return code of the program to do different things:

I'm adding the last one because I have a use case where I want to stop consuming (and restart the client with other parameters) in some case.

ricbra commented 8 years ago

I also added a config setting for default behaviour on failure (onFailure) so closing this issue for now.