Announcement Announcement Module
Collapse
No announcement yet.
throw exception to rollback generates WARN message from spring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • throw exception to rollback generates WARN message from spring

    I have a fairly simple integration chain which, on occasion, throws a RuntimeException in order to cause a message to be rolled back so that it can be redelivered. However, whenever I do so, spring integration throws a WARN level log message with a mile-long exception stack trace, of course). I don't really want to just disable logging of warn level messages from spring integration, since failures to connect to an exclusive JMS queue because another listener is already consuming it also generates a warn level message from the same component, and I want to see that one.

    Specifically, the message says that the problem is the throwing of an exception without registration of an ErrorHandler. However, there really isn't any mention made of registering an ErrorHandler in the spring-integration documentation or in the xml schema. There is mention made of an error channel, but routing an error with a message to an error channel is exactly what I don't want to have happen. Is there some other way to cause a message to roll back after it has already been transformed into some native object via a transformer, since I don't have access to a JMSMessage after the message-driven-channel-adapter has passed it along.

    Any ideas?

    Code:
      <int-jms:message-driven-channel-adapter
        id="workIn" 
        destination="workQueue" 
        channel="workInputChannel"
        max-concurrent-consumers="3" 
        acknowledge="transacted" />
    
      <channel id="workInputChannel" />
      
      <chain id="listenerChain" input-channel="workInputChannel">
        <int-xml:unmarshalling-transformer unmarshaller="jmsMarshaller"/>
        <service-activator ref="workerListener" method="typedReceive"/>
      </chain>
    At the moment, I'm just throwing RuntimeExceptions at random in order to test message rollback, but eventually, the service-activator at the end of the chain could wind up throwing an exception intended to cause rollback and redelivery. The functionality works just fine, but it is unbelievably noisy in the logs.

  • #2
    If you wish, you can define your own DefaultMessageListenerContainer (with a custom ErrorHandler) and inject it into the inbound adapter using the 'container' attribute.

    Comment


    • #3
      Just to be clear, the message-driven-channel-adapter uses the DMLC under the covers. Many common configuration options are provided on the adapter but, for more sophisticated configuration, wire up your own container and inject it into the adapter.

      Comment

      Working...
      X