activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hiram Chirino" <hi...@hiramchirino.com>
Subject Re: ActiveMQ and JTA
Date Fri, 31 Mar 2006 21:26:42 GMT
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.Kunnumpurath@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

Mime
View raw message