Announcement Announcement Module
No announcement yet.
Failsafe messaging queue down Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Failsafe messaging queue down


    I am writing a message onto a channel which is then connected via a channel-adapter to a jms-target, and hence, to a queue. In the event that the queue goes down I need to be able to write that message to the local filesystem, but only for messages that could not be written to the queue. I am currently testing with a configuration using a bogus queue name, and I see that Spring Integration is handling this failure with the MessagePublishingErrorHandler as in the log messages below.

    Can someone tell me how I can route a message that failed to go onto the queue to the local filesystem?


    Logs produced when trying to write a message to a bogus queue:

    10:33:46,532 WARN [MessagePublishingErrorHandler] failure occurred in messaging task
    org.springframework.jms.InvalidDestinationExceptio n: MQJMS2008: failed to open MQ queue 1FOO.ERROR.BOGUS; neste
    d exception is javax.jms.InvalidDestinationException: MQJMS2008: failed to open MQ queue 1FOO.ERROR.BOGUS; nest
    ed exception is MQJE001: Completion Code 2, Reason 2085
    at sAccessException(
    at tJmsAccessException(
    at org.springframework.jms.core.JmsTemplate.execute(J
    at org.springframework.jms.core.JmsTemplate.send(JmsT
    at org.springframework.jms.core.JmsTemplate.convertAn dSend(
    at org.springframework.jms.core.JmsTemplate.convertAn dSend(
    at org.springframework.integration.adapter.jms.JmsTar get.send(
    at org.springframework.integration.endpoint.TargetEnd point.handleMessage(
    at org.springframework.integration.endpoint.TargetEnd point.poll(
    at org.springframework.integration.endpoint.EndpointP oller.visitEndpoint(
    at org.springframework.integration.endpoint.AbstractE ndpoint.doSend(
    at org.springframework.integration.endpoint.AbstractE ndpoint.send(
    at org.springframework.integration.endpoint.AbstractE ndpoint.send(
    at org.springframework.integration.dispatcher.Abstrac tDispatcher.sendMessageToTarget(AbstractDispatcher .jav
    at org.springframework.integration.dispatcher.Broadca stingDispatcher.send( 4)
    at org.springframework.integration.dispatcher.Polling Dispatcher.dispatch(
    at org.springframework.integration.dispatcher.Polling
    at org.springframework.integration.scheduling.SimpleT askScheduler$ va:2
    at java.util.concurrent.Executors$ l(
    at java.util.concurrent.FutureTask$Sync.innerRun(Futu
    at a:123)
    at java.util.concurrent.ScheduledThreadPoolExecutor$S cheduledFutureTask.access$301(ScheduledThreadPoolE xecu
    at java.util.concurrent.ScheduledThreadPoolExecutor$S .jav
    at java.util.concurrent.ThreadPoolExecutor$ Task(
    at java.util.concurrent.ThreadPoolExecutor$ (
    Caused by: javax.jms.InvalidDestinationException: MQJMS2008: failed to open MQ queue 1FOO.ERROR.BOGUS
    at on(
    at ava:6359)
    at org.springframework.jms.core.JmsTemplate.doCreateP roducer(
    at org.springframework.jms.core.JmsTemplate.createPro ducer(
    at org.springframework.jms.core.JmsTemplate.doSend(Jm
    at org.springframework.jms.core.JmsTemplate$4.doInJms (
    at org.springframework.jms.core.JmsTemplate.execute(J
    ... 23 more

  • #2
    The simplest option would probably be to specify your own instance of MessagePublishingErrorHandler as the errorHandler for the JMS OutboundChannelAdapter instance. Then, provide a channel reference for the errorHandler and connect that channel to a FileTarget instance with another channel-adapter. Does that make sense?

    (by the way, this was triple posted - probably because the original posts were awaiting approval... I assume that I can delete those?)