Announcement Announcement Module
No announcement yet.
Problem modifying error channel Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem modifying error channel

    Hallo all:

    I have this simple configuration:

    <!-- Chain error handler -->
    	<int:chain input-channel="defaultErrorChannel" output-channel="responseChannel">
    		<int:service-activator ref="errorHandlerActivator" />
    	<int:gateway id="gateway" service-interface="it.sample.integration.error.gateway.Gateway" default-request-channel="preProcessingChannel"  error-channel="defaultErrorChannel"/>
    	<int:chain input-channel="preProcessingChannel" output-channel="responseChannel">
    			<int:error-channel ref="customErrorChannel"/>
    		<int:service-activator ref="throwExceptionActivator" method="activate" />
    	<int:chain input-channel="customErrorChannel" output-channel="responseChannel">
    		<int:service-activator ref="customErrorHandlerActivator" method="activate" />
    As you can see I need to redefine the error channel on a chain to handle the exceptions thrown by that chain in a particular way.

    I redefined the error channel property on the chain as follows <int:error-channel ref="customErrorChannel"/> but when the sequent activator throws an exception the message is redirected to the defaultErrorChannel defined on the initial gateway.

    Where am I wrong?

    Kind regards

  • #2
    Right, that is because the initial gateway is considered the entry point into a particular segment of your message flow. A flow segment typically depends on the well defined entry point into such segment. Typically its a Gateway and/or Poller. In your case its the Gateway that manages where the exception goes. So if you need the exception to be handled differently from some other part of he flow you may want to artificially segment your flow into sub-flows.
    Look at this example I showed few years ago at Spring One


    • #3
      Ok, now all takes sense.
      I thought that the gateway was the key point, but the documentation on error handling was a little short.

      Kind regards.