You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Meeraj Kunnumpurath <M....@voca.com> on 2006/04/03 10:32:08 UTC

RE: ActiveMQ and JTA

Thanks Hiram. 

-----Original Message-----
From: chirino@gmail.com [mailto:chirino@gmail.com] On Behalf Of Hiram
Chirino
Sent: 31 March 2006 22:27
To: activemq-users@geronimo.apache.org
Subject: Re: ActiveMQ and JTA

Hi Meeraj,

To have activemq connections be controlled by the J2EE container, you
must use connections that have been created using the ActiveMQ resource
adapter.

See:
http://activemq.com/Resource+Adapter

Regards,
Hiram

On 3/31/06, Meeraj Kunnumpurath <M....@voca.com> wrote:
> Hi,
>
> I am using ActiveMQ 4.0 M4 standalone with the message consumers and 
> producers running from a separate Weblogic instance. I have got the 
> following code to send a message using JTA transaction demarcation,
>
> Context ctx = null;
> Connection con = null;
> Session sess = null;
>
> try {
>         context = new InitialContext();
>         UserTransaction utx =
> (UserTransaction)ctx.lookup("javax.transaction.UserTransaction");
>         utx.begin();
>
>         ConnectionFactory cf = new
> ActiveMQConnectionFactory("tcp://localhost:61616");
>         Destination dst = new ActiveMQQueue("submission.queue");
>         Connection con = cf.createConnection();
>         Session sess = con.createSession(false, 
> Session.AUTO_ACKNOWLEDGE);
>
>         MessageProducer prod = sess.createProducer(dst);
>         prod.send(sess.createTextMessage("Test"));
>
>         con.stop();
>         utx.rollback();
>
> } catch(Exception ex) {
>         throw new RuntimeException(ex); } finally {
>         closeResources(ctx, con, sess); }
>
> The message is still being published, despite the transaction being 
> rolled back. Do I need to do anything else so that the ActiveMQ 
> session get enlisted with the transaction manager.
>
> Any pointers would be highly appreciated.
>
> Kind Regards
>
> Meeraj
>
>
>
> *****************************************************
>
>     You can find us at www.voca.com
>
> *****************************************************
> This communication is confidential and intended for the exclusive use 
> of the addressee only. You should not disclose its contents to any 
> other person.
> If you are not the intended recipient please notify the sender named 
> above immediately.
>
> Registered in England, No 1023742,
> Registered Office: Voca Limited
> Drake House, Three Rivers Court,
> Homestead Road, Rickmansworth,
> Hertfordshire, WD3 1FX
>
>
> This message has been checked for all email viruses by MessageLabs.
>


--
Regards,
Hiram

This message has been checked for all email viruses by MessageLabs.



This message has been checked for all email viruses by MessageLabs.