BEA Systems, Inc.

WebLogic Server 6.1 API Reference

weblogic.jms.extensions
Interface MDBTransaction


public interface MDBTransaction

JMS extension to associate a message delivered to a MDB with a transaction.

Author:
Copyright (c) 2001 by BEA Systems, Inc. All Rights Reserved.

Method Summary
 void associateTransaction(javax.jms.Message message)
          This method infects an unacknowledged, non-transactional message with the current transaction.
 

Method Detail

associateTransaction

public void associateTransaction(javax.jms.Message message)
                          throws javax.jms.JMSException
This method infects an unacknowledged, non-transactional message with the current transaction. It is intended for use by transactional message driven bean containers, and IS NOT FOR USE by non-transactional mbeans! The container must use sessions created with acknowledge mode Session.CLIENT_ACKNOWLEDGE 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 need not do this. The message driven bean container looks something like 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); } }

Parameters:
message - javax.jms.Message
Throws:
javax.jms.JMSException - if a JMS error occurs

Documentation is available at
http://e-docs.bea.com/wls/docs61

WebLogic classes and methods that do not appear in this reference are not public and are not supported.