Announcement Announcement Module
No announcement yet.
Handling Exceptions in a ServiceActivator (AMQP subtopic as well...) Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Handling Exceptions in a ServiceActivator (AMQP subtopic as well...)

    Hi All,

    I'm getting to grips with Spring Integration 2.1.0.RC1. After reading the reference manual and looking at some examples, I'm still a little bit confused on how to best handle an application exception that I throw. I would welcome some advice please. Below are snippets of my configuration:

        <int:exception-type-router input-channel="myServiceActivator" default-output-channel="myErrorChannel">
            <int:mapping exception-type="" />
        <int:channel id="myErrorChannel"/>
    Here is myServiceActivator:

        @ServiceActivator(inputChannel = "myServiceActivator")
        public void processMessage(final Message<String> message) throws MyException {
            final String payload = message.getPayload();
    Let's pretend that the doSomething throws a MyException. Does this configuration outlined above seem appropriate to handle the Exception (am I missing a trick?)

    I ask this to help answer another question. I'm hooking up the myErrorChannel to a RabbitMQ exchange, i.e.,

        <int-amqp:outbound-channel-adapter channel="myErrorChannel" exchange-name="" routing-key="myErrorQueueRoutingKey" />
    When the exception gets thrown (assuming my configuration above looks reasonable and I'm not missing a trick on how to *properly* configure spring integration to handle exceptions) I notice in the Queue in Rabbit I have an appropriate message in my Error Queue - but the thing is I only see the payload of the message that arrived from RabbitMQ into Spring Integration and *not* the details of MyException (I would have expected perhaps a stack trace to be the payload that gets sent to RabbitMQ on an error.)

    I would be extremely grateful on some feedback on this issue.

    Thank you so much in advance.


  • #2

    Just wondering if anyone else has any strategies for handling throwing exceptions back from a service activator?