You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Sophia Wright <so...@gmail.com> on 2013/12/04 09:30:26 UTC

Transactions in Stomp

Hi,

I am trying to use transactions in Stomp (Python & perl). I have already
gone through
http://activemq.apache.org/how-do-i-unack-the-message-with-stomp.html

As specified in the page that there is no redelivery in case of stomp. But
what happens if a consumers receives a message and send NACK to the broker ?   



--
View this message in context: http://activemq.2283324.n4.nabble.com/Transactions-in-Stomp-tp4675080.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Transactions in Stomp

Posted by Sophia Wright <so...@gmail.com>.
Thank you for this explanation  



--
View this message in context: http://activemq.2283324.n4.nabble.com/Transactions-in-Stomp-tp4675080p4675214.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Transactions in Stomp

Posted by Christian Posta <ch...@gmail.com>.
there is no "automatic" redelivery on the client side the way activemq
libraries do for openwire. that's because a STOMP client can be
written by anyone and the Spec doesn't address redelivery on the
client side. But, you are of course able to build in a redelivery
functionality yourself.

if you don't commit an interaction that had an "ACK" for a message, or
if your rollback, then the broker will not see the ack and will keep
the message around. on the client side you won't see this being
"redelivered" in order because ActiveMQ also uses a prefetch (as Tim
mentioned). You can set prefetch to 1 to ensure things are delivered
in order and AFAIK the message would be redispatched to your client

On Thu, Dec 5, 2013 at 10:54 AM, Sophia Wright <so...@gmail.com> wrote:
> Yes, that is fine. But my question is " Why there is NO message redelivery in
> case of STOMP transactions (like JMS transactions have) ?
>
>
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Transactions-in-Stomp-tp4675080p4675211.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
Christian Posta
http://www.christianposta.com/blog
twitter: @christianposta

Re: Transactions in Stomp

Posted by Sophia Wright <so...@gmail.com>.
Yes, that is fine. But my question is " Why there is NO message redelivery in
case of STOMP transactions (like JMS transactions have) ? 





--
View this message in context: http://activemq.2283324.n4.nabble.com/Transactions-in-Stomp-tp4675080p4675211.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Transactions in Stomp

Posted by Christian Posta <ch...@gmail.com>.
Transactions allow you to process a "unit of work" or "group messages together"
ACK/NACK aren't applied on the broker until the transaction has been committed.



On Thu, Dec 5, 2013 at 9:09 AM, Sophia Wright <so...@gmail.com> wrote:
> Thanks,
> I am just little bit confused in case of CLIENT_ACK mode in STOMP
> transaction.
>
> At consumer side,
> When consumer is running and throwing exception while processing the message
> (consumer doesn't stop, it keeps on running), there is no redelivery of
> message.
>
> Even if i uses transactions there is no redelivery in above case.
>
> Why so ?  The major advantage of transaction  over acknowledgement modes is
> *msg_redelivery*  ?
> What will be the use case of transactions in STOMP ?
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Transactions-in-Stomp-tp4675080p4675194.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
Christian Posta
http://www.christianposta.com/blog
twitter: @christianposta

Re: Transactions in Stomp

Posted by Sophia Wright <so...@gmail.com>.
Thanks, 
I am just little bit confused in case of CLIENT_ACK mode in STOMP
transaction.

At consumer side, 
When consumer is running and throwing exception while processing the message
(consumer doesn't stop, it keeps on running), there is no redelivery of
message. 

Even if i uses transactions there is no redelivery in above case.

Why so ?  The major advantage of transaction  over acknowledgement modes is
*msg_redelivery*  ?
What will be the use case of transactions in STOMP ?



--
View this message in context: http://activemq.2283324.n4.nabble.com/Transactions-in-Stomp-tp4675080p4675194.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Transactions in Stomp

Posted by Christian Posta <ch...@gmail.com>.
A NACK will should send the message to the DLQ

On Wed, Dec 4, 2013 at 7:54 AM, Sophia Wright <so...@gmail.com> wrote:
> and what happens in case of NACK ( the first question) ?
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Transactions-in-Stomp-tp4675080p4675103.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
Christian Posta
http://www.christianposta.com/blog
twitter: @christianposta

Re: Transactions in Stomp

Posted by Sophia Wright <so...@gmail.com>.
and what happens in case of NACK ( the first question) ?



--
View this message in context: http://activemq.2283324.n4.nabble.com/Transactions-in-Stomp-tp4675080p4675103.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Transactions in Stomp

Posted by Timothy Bish <ta...@gmail.com>.
On 12/04/2013 03:49 AM, Sophia Wright wrote:
> In addition to the last question..
>
> As specified on the page
> http://activemq.apache.org/how-do-i-unack-the-message-with-stomp.html
>
> ---------How to receive the message in transactions using
> CLIENT_ACK--------------------
> connection.begin("tx3");
> frame = connection.receive();
> System.out.println(frame.getBody());
> connection.ack(frame, "tx3");
> connection.commit("tx3");
> -------------------------------------------------------
>
> In the above source code,
> 1) What is the internal ActiveMQ processing of message between
> connection.ack() and connection.commit() ?
> 2) Can I use receive more then one messages(receive---ack--receive--ack....)
> in one transaction and then commit it once ?
>
>
>   
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Transactions-in-Stomp-tp4675080p4675082.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
You can receive without acking but at some point you will hit the 
prefetch limit, depending on what you configure it as, so you would need 
to start acking messages if you intend to consume a large batch inside a 
single transaction.

-- 
Tim Bish
Sr Software Engineer | RedHat Inc.
tim.bish@redhat.com | www.fusesource.com | www.redhat.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/


Re: Transactions in Stomp

Posted by Sophia Wright <so...@gmail.com>.
In addition to the last question..

As specified on the page
http://activemq.apache.org/how-do-i-unack-the-message-with-stomp.html

---------How to receive the message in transactions using
CLIENT_ACK--------------------
connection.begin("tx3");
frame = connection.receive();
System.out.println(frame.getBody());
connection.ack(frame, "tx3");
connection.commit("tx3");
-------------------------------------------------------

In the above source code, 
1) What is the internal ActiveMQ processing of message between
connection.ack() and connection.commit() ?
2) Can I use receive more then one messages(receive---ack--receive--ack....)
in one transaction and then commit it once ? 


 



--
View this message in context: http://activemq.2283324.n4.nabble.com/Transactions-in-Stomp-tp4675080p4675082.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.