How do I issue the close() method within an onmessage() method call and what are the semantics of the close() method? : BEA Weblogic
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 |
What are the databases that are available to be used with the web logic j2ee connector architecture?
Tell me what can happen when stub can't to connect to web-logic server instances?
Why did the messaging bridge fail to connect to the source bridge destination? : BEA Weblogic
what is the weblogi licence?
What are the ways to avoid resourceexceptions when sending requests for databaseconnections?
Why is there no polymorphic-type response from a create () or find () method?
How do you troubleshoot a crash?
How you deploy your applications on weblogic server?
Can weblogic server start with a unix boot? : BEA Weblogic
How to debug my ant script?
How are multi-byte characters used with weblogic jdriver?
How to upgrade the weblogic version and explain the steps?