2 Replies Latest reply: Aug 2, 2011 6:31 AM by Tino Sainz RSS

    Transactional scenario on HornetQ 2.2.2

    Tino Sainz Newbie

      Hello,

       

      Im working in an multithreaded application, it takes objects from a queue and processes them. I have been using manual acknowledgment. Basically, if my code reachs some point (aka, no exceptions nor errors), i acknowledge the message, otherwise i dont. But i have a problem, i cant send a failure-acknowledgement. I mean, until my session/connection closes (in real operation, theorically never), the message will remain delivering and i cant say something like "leave it, it failed". I know acknoledgement its about checking network failures and such. But it would be nice if there is a way to do this.

       

      ¿Should i look at transactional examples to do this?

      I use same queueReceiver/sender for all threads (i can change this, but i suposse/tested a little they are thread-safe?) and i would like to rollback only one message.

       

      Using hornetQ 2.2.2 standalone.

       

      Thanks for your time,

        • 1. Re: Transactional scenario on HornetQ 2.2.2
          Andy Taylor Master

          Im working in an multithreaded application, it takes objects from a queue and processes them. I have been using manual acknowledgment. Basically, if my code reachs some point (aka, no exceptions nor errors), i acknowledge the message, otherwise i dont. But i have a problem, i cant send a failure-acknowledgement. I mean, until my session/connection closes (in real operation, theorically never), the message will remain delivering and i cant say something like "leave it, it failed". I know acknoledgement its about checking network failures and such. But it would be nice if there is a way to do this.

          Simply create the session transacted and rollback.

           

          I use same queueReceiver/sender for all threads (i can change this, but i suposse/tested a little they are thread-safe?) and i would like to rollback only one message.

          Yes, sessions are not JMS resources are not meant to be accessed by multiple threads, use 1 session/producer/consumer per thread, this will also speed up your app.

          • 2. Re: Transactional scenario on HornetQ 2.2.2
            Tino Sainz Newbie

            Thanks, much appreciated =)