Having trouble handling exceptions in Spring Integration

前端 未结 1 1248
难免孤独
难免孤独 2021-01-23 10:52

I\'m new to spring integration and am confused about how to send error messages to a designated error queue. I want the error message to be a header on the original message and

1条回答
  •  遥遥无期
    2021-01-23 11:21

    When the exception is thrown, it is wrapped together with the requestMessage to the MessagingException. Your own business exception is in the cause and you can get access to the requestMessage from the MessagingException.failedMessage property.

    So, it looks like you have everything you need for your use-case. Only the problem that before sending to the error-exchange you really should have some in the error flow to properly convert that MessagingException to the proper message to send to the AMQP.

    0 讨论(0)
提交回复
热议问题