How do I issue the close() method within an onmessage() method call and what are the semantics of the close() method? : BEA Weblogic



How do I issue the close() method within an onmessage() method call and what are the semantics of th..

Answer / Jaideep Shrivastava

To issue the close() method within an onmessage() method call in a Message Driven Bean (MDB) in WebLogic, you can use a finally block to ensure that the connection is closed even if an exception occurs. Here's a simplified example:n```javanpublic void onMessage(Message message) {n try ({n Connection connection = message.getJMSConnection();n Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);n // Process the message heren }n finally {n if (connection != null) {n try {
connection.close();
} catch (JMSException e) {
// handle exception
}n }n })n```nThe close() method in JMS is used to release the resources associated with a Connection or Session object, including the physical connection to the JMS provider. This can help to reduce resource consumption and prevent leaks.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Weblogic Interview Questions

What are the databases that are available to be used with the web logic j2ee connector architecture?

1 Answers  


Tell me what can happen when stub can't to connect to web-logic server instances?

1 Answers  


Why did the messaging bridge fail to connect to the source bridge destination? : BEA Weblogic

1 Answers  


what is the weblogi licence?

3 Answers   TCS,


What are the ways to avoid resourceexceptions when sending requests for databaseconnections?

1 Answers  


Why is there no polymorphic-type response from a create () or find () method?

1 Answers  


How do you troubleshoot a crash?

1 Answers  


How you deploy your applications on weblogic server?

1 Answers  


Can weblogic server start with a unix boot? : BEA Weblogic

1 Answers  


How to debug my ant script?

1 Answers  


How are multi-byte characters used with weblogic jdriver?

1 Answers  


How to upgrade the weblogic version and explain the steps?

1 Answers   Oracle, TCS,


Categories