Hi Robbie And Team,

After your suggetion for handling exception for Producer in Catch Block and
create again once Producer closed. I implemented this scenario. I can get
exception with the use of CompletionListener only. So everytime i need to
supply CompletionHandler for handling exception. 

For successful scenario - I am getting callback in
SendCompletionHandler-->onCompletion method which is perfect. 
For Failed Scenario -- I am getting exception on catch block() of dispatch
operation. But i am not getting callback on
SendCompletionHandler-->onException ? Please find below code snippet. 

I have doubt on this, Why i am not getting callback on
"SendCompletionHandler-->onException" ? 
Could you please suggest, why i am not getting callback on "onException"
operation or implementation is working perfectly. 


//////// Code 

        //Global var
        SendCompletionHandler sendCompletionHandler = new 
SendCompletionHandler();
        
        public void dispatch(){
                try {
                        producer.send(message, sendCompletionHandler);
                } catch (IllegalStateException illegalStateException) { // *** 
Getting
Exception Callback here ***
                        System.err.println("*** 
illegalStateException.getMessage() ***" +
illegalStateException.getMessage());

                        if (illegalStateException.getMessage().contains("The 
MessageProducer is
closed")) {
                                // Reset Producer due to Idle TimeOut after 10m
                                producer = createProducer(session, endpoint);
                                producer.send(message, sendCompletionHandler));
                        }else{
                                throw illegalStateException;
                        }
                } 
        }
        
        class SendCompletionHandler implements CompletionListener {

                @Override
                public void onCompletion(Message message) {
                        logger.info("Completed JMSMessageID :: " + 
message.getJMSMessageID());
                }

                @Override
                public void onException(Message message, Exception exception) {
                        try {
                                logger.error("Failed message JMSMessageID :: " +
message.getJMSMessageID());
                        } catch (JMSException e) {
                                e.printStackTrace();
                        }

                }

        }
        
        Regards,
        Abhishek Kumar



--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to