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

  • Failsafe messaging queue down

    Gang,

    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?

    Thanks!

    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 com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2085
    at org.springframework.jms.support.JmsUtils.convertJm sAccessException(JmsUtils.java:258)
    at org.springframework.jms.support.JmsAccessor.conver tJmsAccessException(JmsAccessor.java:168)
    at org.springframework.jms.core.JmsTemplate.execute(J msTemplate.java:462)
    at org.springframework.jms.core.JmsTemplate.send(JmsT emplate.java:535)
    at org.springframework.jms.core.JmsTemplate.convertAn dSend(JmsTemplate.java:614)
    at org.springframework.jms.core.JmsTemplate.convertAn dSend(JmsTemplate.java:599)
    at org.springframework.integration.adapter.jms.JmsTar get.send(JmsTarget.java:54)
    at org.springframework.integration.endpoint.TargetEnd point.handleMessage(TargetEndpoint.java:103)
    at org.springframework.integration.endpoint.TargetEnd point.poll(TargetEndpoint.java:111)
    at org.springframework.integration.endpoint.EndpointP oller.visitEndpoint(EndpointPoller.java:25)
    at org.springframework.integration.endpoint.AbstractE ndpoint.doSend(AbstractEndpoint.java:252)
    at org.springframework.integration.endpoint.AbstractE ndpoint.send(AbstractEndpoint.java:225)
    at org.springframework.integration.endpoint.AbstractE ndpoint.send(AbstractEndpoint.java:213)
    at org.springframework.integration.dispatcher.Abstrac tDispatcher.sendMessageToTarget(AbstractDispatcher .jav
    a:74)
    at org.springframework.integration.dispatcher.Broadca stingDispatcher.send(BroadcastingDispatcher.java:4 4)
    at org.springframework.integration.dispatcher.Polling Dispatcher.dispatch(PollingDispatcher.java:116)
    at org.springframework.integration.dispatcher.Polling Dispatcher.run(PollingDispatcher.java:102)
    at org.springframework.integration.scheduling.SimpleT askScheduler$TaskRunner.run(SimpleTaskScheduler.ja va:2
    06)
    at java.util.concurrent.Executors$RunnableAdapter.cal l(Executors.java:417)
    at java.util.concurrent.FutureTask$Sync.innerRun(Futu reTask.java:269)
    at java.util.concurrent.FutureTask.run(FutureTask.jav a:123)
    at java.util.concurrent.ScheduledThreadPoolExecutor$S cheduledFutureTask.access$301(ScheduledThreadPoolE xecu
    tor.java:65)
    at java.util.concurrent.ScheduledThreadPoolExecutor$S cheduledFutureTask.run(ScheduledThreadPoolExecutor .jav
    a:168)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExecutor.java:650)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:675)
    at java.lang.Thread.run(Thread.java:595)
    Caused by: javax.jms.InvalidDestinationException: MQJMS2008: failed to open MQ queue 1FOO.ERROR.BOGUS
    at com.ibm.mq.jms.MQQueueServices.getQueueOpenExcepti on(MQQueueServices.java:412)
    at com.ibm.mq.jms.MQQueueServices.getOutputQueue(MQQu eueServices.java:354)
    at com.ibm.mq.jms.JMSServicesMgr.getOutputQueue(JMSSe rvicesMgr.java:145)
    at com.ibm.mq.jms.MQSession.createQSender(MQSession.j ava:6359)
    at com.ibm.mq.jms.MQQueueSession.createSender(MQQueue Session.java:240)
    at com.ibm.mq.jms.MQQueueSession.createProducer(MQQue ueSession.java:360)
    at org.springframework.jms.core.JmsTemplate.doCreateP roducer(JmsTemplate.java:974)
    at org.springframework.jms.core.JmsTemplate.createPro ducer(JmsTemplate.java:955)
    at org.springframework.jms.core.JmsTemplate.doSend(Jm sTemplate.java:555)
    at org.springframework.jms.core.JmsTemplate$4.doInJms (JmsTemplate.java:538)
    at org.springframework.jms.core.JmsTemplate.execute(J msTemplate.java:459)
    ... 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?)

    Comment

    Working...
    X