Discussions

EJB programming & troubleshooting: MDB transaction configuration

  1. MDB transaction configuration (3 messages)

    I am new to JMS and MDB concepts and I need help with the following problem (server is WebLogic 702):
    JMS producer sends a message to a queue. MDB receives a message and calls a session ejb method to process a file. Message should be sent only once. File is processed in such a way that a number of lines is parsed, validated and loaded into a table of the database. I don't know how to configure the transaction management attributes of the MDB and EJB. The EJB should have a Container managed transaction setting with Never or Not Supported attribute, because batches of file processing should not be inside a transaction. Any suggestion is highly appreciated.
    Zlata

    Threaded Messages (3)

  2. MDB transaction configuration[ Go to top ]

    From http://www.theserverside.com/articles/article.tss?l=Pramati-MDB

    What is a Message Driven Bean?
    A message driven bean is a stateless, server-side, transaction-aware component that is driven by a Java message (javax.jms.message). It is invoked by the EJB Container when a message is received from a JMS Queue or Topic. It acts as a simple message listener.
  3. MDB transaction configuration[ Go to top ]

    You have to define the transaction attribute in the ejb-jar.xml as follows:

    <container-transaction>
             <method>
               <ejb-name>PSsimpleMdb</ejb-name>
               <method-name>onMessage</method-name>
               <method-params>
                 <method-param>javax.jms.Message</method-param>
               </method-params>
             </method>
             <trans-attribute>Required</trans-attribute>
           </container-transaction>

    Only Required or NotSupported is supported with MDB

    Here is a sample MDB application

    http://www.oracle.com/technology/tech/java/oc4j/904/how_to/how-to-ejb-mdb.zip - Here is a sample MDB

    Here is an article I wrote on MDB using JCAResource Adapter
    http://www.onjava.com/pub/a/onjava/2004/06/23/mdbjca.html

    Hope this helps

    regards
    Debu Panda
    http://radio.weblogs.com/0135826
  4. MDB transaction configuration[ Go to top ]

    When would you use 'Not supported' for the transaction type?