j2ee‎ > ‎

JMS/JDBC Transaction integrationd Post

posted Jun 20, 2010, 7:26 PM by Kuwon Kang

요즘 한창 EJB기반의 JTA Transaction Manager와  JMS 를 연동중에 있다.

이중에 아래 session transacted에 관하여 정리한다.

setSessionTransacted

public void setSessionTransacted(boolean sessionTransacted)
Set the transaction mode that is used when creating a JMS Session. Default is "false".Note that within a JTA transaction, the parameters passed to create(Queue/Topic)Session(boolean transacted, int acknowledgeMode) method are not taken into account. Depending on the J2EE transaction context, the container makes its own decisions on these values. Analogously, these parameters are not taken into account within a locally managed transaction either, since the accessor operates on an existing JMS Session in this case.

Setting this flag to "true" will use a short local JMS transaction when running outside of a managed transaction, and a synchronized local JMS transaction in case of a managed transaction (other than an XA transaction) being present. The latter has the effect of a local JMS transaction being managed alongside the main transaction (which might be a native JDBC transaction), with the JMS transaction committing right after the main transaction.

Parameters:
sessionTransacted - the transaction mode
See Also:
Connection.createSession(boolean, int)

EJB또는 JTA 안에서 사용되는 JMS Transaction은 sessionTransacted의 설정과 관계없이 J2EE Container에 따라 결정된다.

Enterprise의 요건데 따라 JMS와 JTA 또는 EJB Container의 Transaction Context에 위임 또는 분리하도록 한다.

Comments