Announcement Announcement Module
Collapse
No announcement yet.
Handling Exceptions in a ServiceActivator (AMQP subtopic as well...) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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:

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

    Code:
        @ServiceActivator(inputChannel = "myServiceActivator")
        public void processMessage(final Message<String> message) throws MyException {
            final String payload = message.getPayload();
            myBean.doSomething(payload);
        }
    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.,

    Code:
        <int-amqp:outbound-channel-adapter channel="myErrorChannel" exchange-name="amq.direct" 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.

    -=bootlaces=-

  • #2
    Hi,

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

    Thanks.

    -=david=-

    Comment

    Working...
    X