Results 1 to 6 of 6

Thread: Error handling.

  1. #1
    Join Date
    Aug 2012
    Posts
    16

    Default Error handling.

    Hi all,
    I am using spring integration with amqp. I need to route my error messages into rabbit queues after my retry interceptor advice chain has done retry.
    How can I specify an error channel in my inbound- adapter advice chain after the retry policy is completed so that it will re-queue the error message into multiple error queues.


    Thanks in advance for the help.

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

    Default

    Probably the easiest way is to set up the queue with a Dead Letter Exchange and use a RejectAndDontRequeueRecoverer on the retry advice, and the messages will be sent to the DLX; you can then bind whatever queues you want to the DLX.

    There was a recent discussion about it here... http://forum.springsource.org/showth...etry-max-times
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  3. #3
    Join Date
    Jan 2009
    Location
    Ukraine, Kharkov
    Posts
    736

    Default

    Hi!

    AS I understand you're using advice-chain on the <amqp:inbound-channel-adapter>.
    So, there is another useful attribute for your wishes - error-handler. The provided one will be invoked exectly after your retry will be exhausted: AbstractMessageListenerContainer#executeListener
    And there is an ErrorHandler implementation out of the box - MessagePublishingErrorHandler.
    I think it may resolve your requirements.
    Nevertheless IMO it's bad idea to make retry on the listener. If your Message causes an Exception in the downstream flow it's not a problem of AMQP-Listener. The real issue may lie inside some of your services. So, why don't do retry there.
    Take a look here: http://static.springsource.org/sprin...r-advice-chain
    https://github.com/SpringSource/spri...retry-and-more
    Maybe it will change your mind.

    Cheers,
    Artem

  4. #4
    Join Date
    Aug 2012
    Posts
    16

    Default

    Hi,
    @cleric @gary,
    I've implemented
    Dead Letter Exchange and use a RejectAndDontRequeueRecoverer on the retry advice, and the messages will be sent to the DLX
    I have multiple inbound adapters.But I need some mechanism to route message from my Dead Letter Exchange to different queues. How can I achieve this. Is there some way that I can add some routing key so I can route it from there.

  5. #5
    Join Date
    Jan 2009
    Location
    Ukraine, Kharkov
    Posts
    736

    Default

    Is there some way that I can add some routing key so I can route it from there.
    But how about this one: x-dead-letter-routing-key along with x-dead-letter-exchange?
    In this case you can configure each your original queues for the same Direct DLX, but with unique x-dead-letter-routing-key.
    And further you should configure binding for those DL-keys and their queues as for regular ones.

  6. #6
    Join Date
    Aug 2012
    Posts
    16

    Default

    Quote Originally Posted by Cleric;435113x-dead-letter-routing-key along with [B
    x-dead-letter-exchange[/B].
    Thanks a ton cleric.
    That did the job for me .

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
  •