Announcement Announcement Module
Collapse
No announcement yet.
Unable to stop the container on exception Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unable to stop the container on exception

    I have a container(DefaultMessageListenerContainer) that accepts messages and sends it further on to multiple destinations...

    1.The message sending to multiple destinations, is taken as one atomic transaction....so if any one message sending fails....the message needs to be rolled back from the source.....this is not working as the session is not being rolled back to previous state

    2.The container needs to be suspended until further notice...when the above occurs....this is to be done via code....I am unable to get a handle to stopping the container....in my message listener....the only way i think is to stop it via making a jmx call...rather than exposing the container bean instance to the listener

    The first one is critical....any suggestions ...
    Last edited by deepinder10; May 27th, 2009, 12:52 PM. Reason: no response

  • #2
    Update

    This is the code i have changed of doExecuteListener(Session session, Message message) throws JMSException...It is working for me as i donot loose the message ..doing a shutdown when an exception occurs ...as I cannot get a handle on the session to rollback...as I see the message is being removed from the incoming destination.....

    Minus the changes ...in the log file....it is shown that a message rollback is being done when an exception occurs in listener....but in reality the message is being removed from the activemq queue upon an exception...despite client_ackowledge and sessionTransacted=true........the messages overtime get completey removed from the queue...the exception thrown by the listener is UncategorizedJmsException....this is thrown by the jmsTemplate used within the listener to send to another destination.....

    I m not an expert ....but will try this with ibm mq and come back with my findings...should not work as activemq is also jms compliant....

    Now the problem i face is that ....with the below changes.......when the number of consumers is increased to more than one...when the ordering of messages is not a criteria....i am wondering whether it will manage to remove messages from the incoming queue then....


    try {
    invokeListener(session, message);
    } catch (JMSException ex) {
    System.out.println("inside doExecutelistener" + ex);
    this.shutdown();
    rollbackOnExceptionIfNecessary(session, ex);
    throw ex;
    } catch (RuntimeException ex) {
    System.out.println("inside doExecutelistener" + ex);
    this.shutdown();
    rollbackOnExceptionIfNecessary(session, ex);
    throw ex;
    } catch (Error err) {
    this.shutdown();
    rollbackOnExceptionIfNecessary(session, err);
    throw err;
    }
    Last edited by deepinder10; May 27th, 2009, 12:50 PM.

    Comment

    Working...
    X