Announcement Announcement Module
Collapse
No announcement yet.
Handle Exception in spring xml Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Handle Exception in spring xml

    I am using Spring integration 2.15.

    Problem: While sending message using jms on queue, i am unable to retrieve my message if an error occur.

    My xml code is:

    <channel id="toJMS" />
    <channel id="toJMSobj" />

    <channel id="fromJMS" />
    <jms:message-driven-channel-adapter
    channel="fromJMS" destination-name="app42.queue.test" />

    <service-activator input-channel="fromJMS"
    output-channel="toJMSobj" ref="messageListener" method="test">
    </service-activator>

    <jms:outbound-channel-adapter channel="toJMS"
    destination-name="app42.test.queue" />

    <object-to-string-transformer
    input-channel="toJMSobj" output-channel="toJMS">
    </object-to-string-transformer>

    <beans:bean id="connectionFactory"
    class="org.apache.activemq.ActiveMQConnectionFacto ry">
    <beansroperty name="brokerURL" value="tcp://localhost:61616" />
    <!-- <beansroperty name="exceptionListener" ref="jmsExceptionListener"/> -->

    </beans:bean>

    <beans:bean id="jmsExceptionListener"
    class="com.test..TestService" />
    <beans:bean id="messageListener"
    class="com.test.TestMessage" />



    Question: If jms is down, exception will occur, How can i handle that exception and retrieve my message?


    p.s, : dont want to change my existing code.

  • #2
    Hi!

    At a glance it isn't clear what you mean...
    However the <jms:message-driven-channel-adapter> has an "error-channel" attribute. So, you can subscribe to that channel any <service-activator> and handle the ErrorMessage there.
    i am unable to retrieve my message
    H-m-m.
    If your <jms:message-driven-channel-adapter> downstream message flow is synchronous (at the JMS-listener) thread, your JMS-transaction has to be rolled back. And so you JMS-Message should return to the queue.

    Now I don't see what's going on. Sorry

    Artem

    Comment


    • #3
      As Artem said, your question is not clear.

      Question: If jms is down, exception will occur, How can i handle that exception and retrieve my message?
      If JMS is down, how would you expect to be able to retrieve a message?

      Comment

      Working...
      X