dev@glassfish.java.net

Re: How do we move the control of transaction from MDB to Container in Glassfish

From: Kenneth Saks <Kenneth.Saks_at_Sun.COM>
Date: Tue, 26 Aug 2008 08:25:47 -0400

On Aug 25, 2008, at 8:04 PM, kiran tummala wrote:

> Hi,
>
> We have an Message Driven Bean, It subscribes to a message, and
> based on message needs to transcode a media file. If there is a
> failure in the process, we thrown exceptions and in the exception we
> are explicitly calling rollback of message. We would like the
> container to handle this process and found this material
>
> "Because JMS is a full-fledged transaction resource manager, JMS
> work, such as message consumption, and other transaction work can be
> grouped into one transaction. This means that you can choose to make
> a message-driven bean part of a transaction or not. The deployment
> descriptor transaction attribute, which for a message-driven bean
> can be either Required or NotSupported, determines whether or not
> the bean participates in a transaction. (If the message-driven bean
> participates in a transaction, you must also be using container-
> managed transaction demarcation.)"
>
> We would like to use the deployment descriptor transaction attribute
> and set it to Required, so that container manages the transaction.
> How do we configure this in glassfish.

Hi Kiran,

Container managed transactions and tx attribute REQUIRED are the
defaults in EJB 3.0 so you shouldn't have to configure anything. If
you do want to configure them explicitly the easiest way is to use
annotations. Just add @TransactionManagement(CONTAINER) at the message
driven bean class level and @TransactionAttribute(REQUIRED) to the
onMessage method.

> Do we need to do anything special in Netbeans to achieve this.
>
> thanks,
>
>
> Kiran
>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>