Skip Menu |
 

This queue is for tickets about the Net-STOMP-Client CPAN distribution.

Report information
The Basics
Id: 121700
Status: open
Priority: 0/
Queue: Net-STOMP-Client

People
Owner: Nobody in particular
Requestors: abhishek.iit001 [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Regarding use of receipts for sending messages
Date: Tue, 16 May 2017 15:26:46 +0530
To: bug-Net-STOMP-Client [...] rt.cpan.org
From: Abhishek Choudhary <abhishek.iit001 [...] gmail.com>
Download (untitled) / with headers
text/plain 1015b
Hi, I am sending messages to ActiveMQ server and using receipts. I observed an issue where if my ActiveMQ server restarts and my sender application retries to send the same message using the same receipt id, it dies with following erorr: '(error: duplicate receipt: 365e7b8-591ac453-e8f0-de56-11);' This is coming from following function in Client/Receipt.pm: sub _client_hook ($$) { my($self, $frame) = @_; my($value); $value = $frame->header("receipt"); return unless defined($value); dief("duplicate receipt: %s", $value) if $self->{"receipts"}{$value}++; } As I understand this hook is connected to all client FRAMES including 'SEND' and this error is happening because I retry to send the same messages with same receipt id. Do you think this is the correct behavior as my send call was never successful and hence the server couldn't have acknowledged with a RECEIPT frame so it isn't really a duplicate receipt id case? How do you think i should handle this case? Thanks, Abhishek
Download (untitled) / with headers
text/plain 121b
Receipt ids are meant to be unique. If you resend the same message a second time, you should use a different receipt id.
Subject: Re: [rt.cpan.org #121700] Regarding use of receipts for sending messages
Date: Tue, 16 May 2017 16:06:48 +0530
To: bug-Net-STOMP-Client [...] rt.cpan.org
From: Abhishek Choudhary <abhishek.iit001 [...] gmail.com>
Download (untitled) / with headers
text/plain 629b
I am not re-sending the same message second time. It is a retry of the same message in next send() since the first send() failed due to a temporary disconnect from server. Is it a requirement by the api that every send frame have a different receipt id because STOMP specification doesn't specify any such requirement. Thanks, Abhishek On Tue, May 16, 2017 at 3:53 PM, Lionel Cons via RT < bug-Net-STOMP-Client@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=121700 > > > Receipt ids are meant to be unique. > > If you resend the same message a second time, you should use a different > receipt id. >
Download (untitled) / with headers
text/plain 505b
The STOMP specification contains: "Any client frame other than CONNECT MAY specify a receipt header with an arbitrary value. This will cause the server to acknowledge the processing of the client frame with a RECEIPT frame". If you send two frames with the same receipt id then, if you do get a RECEIPT frame back, you have no way to find out which frame got successfully processed. Although it is not (strictly speaking) mandatory, it is good practice to use different receipt ids for different frames.
Subject: Re: [rt.cpan.org #121700] Regarding use of receipts for sending messages
Date: Tue, 16 May 2017 19:15:17 +0530
To: bug-Net-STOMP-Client [...] rt.cpan.org
From: Abhishek Choudhary <abhishek.iit001 [...] gmail.com>
Download (untitled) / with headers
text/plain 1.4k
Thanks for your quick replies and suggestions, Lionel. In my application i use receipt ids to uniquely identify messages that i am sending. So I am looking for a work-around to avoid using a different receipt id for the same message during a retry send call. Will clearing the receipt id from $self->{"receipts"} help before retrying the send call, similar to what is done in _receipt_hook below. Is is safe to do this when retrying the same message? sub _receipt_hook ($$) { my($self, $frame) = @_; my($value); $value = $frame->header("receipt-id"); dief("missing receipt-id in RECEIPT frame") unless defined($value); dief("unexpected receipt: %s", $value) unless $self->{"receipts"} and $self->{"receipts"}{$value}; delete($self->{"receipts"}{$value}); } Thanks for all the help once again. On Tue, May 16, 2017 at 4:35 PM, Lionel Cons via RT < bug-Net-STOMP-Client@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=121700 > > > The STOMP specification contains: "Any client frame other than CONNECT MAY > specify a receipt header with an arbitrary value. This will cause the > server to acknowledge the processing of the client frame with a RECEIPT > frame". > > If you send two frames with the same receipt id then, if you do get a > RECEIPT frame back, you have no way to find out which frame got > successfully processed. > > Although it is not (strictly speaking) mandatory, it is good practice to > use different receipt ids for different frames. >
Download (untitled) / with headers
text/plain 149b
Yes, removing the receipt id from the hash should do what you want: the library will forget that it sent such a frame and did not get a reply back...


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.