Skip Menu |
 

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

Report information
The Basics
Id: 70670
Status: resolved
Priority: 0/
Queue: Net-Stomp

People
Owner: JTANG [...] cpan.org
Requestors: DAKKAR [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.42
Fixed in: 0.43

Attachments


Download (untitled) / with headers
text/plain 427b
The current (0.42) "subscribe" and "unsubscribe" methods assume that we always subscribe only once per destination. Since it's possible to specify selectors in a subscription, it makes sense to subscribe more than once to the same destination, with different selectors. The attached patch changes the way the "subscriptions" hash is keyed, preferring to use subscription ID rather than destination, when the ID is supplied.
Subject: net-stomp-subscribe-by-id.patch
diff --git c/lib/Net/Stomp.pm w/lib/Net/Stomp.pm index 7d51a39..c0fbabc 100644 --- c/lib/Net/Stomp.pm +++ w/lib/Net/Stomp.pm @@ -219,13 +219,20 @@ sub send_transactional { } } +sub _sub_key { + my ($conf) = @_; + + if ($conf->{id}) { return "id-".$conf->{id} } + return "dest-".$conf->{destination} +} + sub subscribe { my ( $self, $conf ) = @_; my $frame = Net::Stomp::Frame->new( { command => 'SUBSCRIBE', headers => $conf } ); $self->send_frame($frame); my $subs = $self->subscriptions; - $subs->{$conf->{'destination'}} = $conf; + $subs->{_sub_key($conf)} = $conf; } sub unsubscribe { @@ -234,7 +241,7 @@ sub unsubscribe { { command => 'UNSUBSCRIBE', headers => $conf } ); $self->send_frame($frame); my $subs = $self->subscriptions; - delete $subs->{$conf->{'destination'}}; + delete $subs->{_sub_key($conf)} } sub ack {
fix in 0.43


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.