|
Oracle Fusion Middleware Java API Reference for Oracle WebLogic Server 12c (12.1.2) Part Number E27170-02 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface MDBTransaction
JMS extension to associate a message delivered to a MDB (message-driven bean) with a transaction.
Note: As of WebLogic Server release 7.0, MDBs support transactions for foreign JMS vendors that do not implement this interface.
Method Summary | |
---|---|
void |
associateTransaction(Message message)
This method infects an unacknowledged, non-transactional message with the current transaction. |
Method Detail |
---|
void associateTransaction(Message message) throws JMSException
The container must use sessions created with the Session.CLIENT_ACKNOWLEDGE acknowledge mode, and must not call "acknowledge" directly. The container must use only one consumer per session. Since JMS schedules onMessage calls in their own thread, the container does not need to do this.
The MDB container should look similar to this:
import weblogic.jms.extension.MDBTransaction; class MBeanContainer implements MessageListener { void onMessage(Message message) { // container may have a utx pool or create a new tran on the spot UserTransaction utx = allocateTransaction(); utx.begin(); // may throw exception // may throw exception ((MDBTransaction)session).associateTransaction(message); // pass message to client in same thread as utx.begin() call // so that it gets infected. userMBean.heresAMessage(message); on success utx.commit(); // may throw exception on failure utx.rollback(); // may throw exception // return utx to pool freeTransaction(utx); } }
message
- javax.jms.Message
JMSException
- if a JMS error occurs
|
Copyright 1996, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Oracle Fusion Middleware Java API Reference for Oracle WebLogic Server 12c (12.1.2) Part Number E27170-02 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |