Results 1 to 4 of 4

Thread: How can i modify & reject a received message to rabbit broker?

  1. #1
    Join Date
    Nov 2012
    Posts
    18

    Default How can i modify & reject a received message to rabbit broker?

    As a amqp-client, spring-amqp really done a pretty nice job in my mq-based email app. Thanks all of spring-amqp-team.

    I use Dead Letter Exchange(DLX) and spring-retry for the bussness exceptions handling when consuming a message.
    When certain exception is throwed, i will retry it. if max-retry-count is exhausted & the message is still not be processing appropriately, i will not requeue it (to the original queue) any more & put it to the dead-letter-exchange.

    There are variety of reasons that lead to fails of message consuming, and I classify them based on custom exceptions. Before put failed message to the DLX, i want add some error-description to this message, So another consumer that listening to the DLX can retrieve & analysis & process it according to the error-description. How can i modifying the failed message, add some extra error-desc to it?

    Here is another thread that i posted on the rabbitmq-discuss:
    http://rabbitmq.1065348.n5.nabble.co...r-td24145.html
    sound like if i want modify the original message, i must use republish instead of reject & DLX, is that true?

    Thanks for the reply! greatly appreciated!

    Regards.

  2. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,037

    Default

    That is correct; you can't modify the original message.

    You can add a custom MessageRecoverer to your retry factory bean and publish a new message to your DLX directly, rather than having the broker publish the original message.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  3. #3
    Join Date
    Nov 2012
    Posts
    18

    Default

    Thank you very much, Gary. How warm-hearted you are!

    So i can't modify the original message, even the MessageProperties or headers of it?
    Last edited by Wuaner; Jan 3rd, 2013 at 09:48 PM.

  4. #4
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,037

    Default

    No, you can't modify the original message at all.
    Last edited by Gary Russell; Jan 4th, 2013 at 08:11 AM.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •