activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Tully <gary.tu...@gmail.com>
Subject Re: Net::Stomp and transactions and receive_frame()
Date Wed, 28 Sep 2011 09:56:00 GMT
you need to correlate the receipt ids as there is nothing to sync
replys and message dispatch.

Have a peek at http://search.cpan.org/~lcons/Net-STOMP-Client-1.2/lib/Net/STOMP/Client.pm#RECEIPTS

that has some built in receipt management

On 28 September 2011 10:37, Kevin Goess <knet@goess.org> wrote:
> Here's a complete repro case.  Either it's not supposed to work this way or
> I'm doing something wrong:
>
> use Net::Stomp;
>
> use strict;
>
> my $stomp = Net::Stomp->new( { hostname => 'bpdeb', port => '61612' } );
> $stomp->connect( { login => 'hello', passcode => 'there' } );
>
> # pre-populate the two queues
> $stomp->send( { destination => '/queue/FOO.BAR', body => 'test message' } );
> $stomp->send( { destination => '/queue/FOO.BAR2', body => 'test message' }
> );
>
>
> # now subscribe to them
> $stomp->subscribe({ destination => '/queue/FOO.BAR',
>                   'ack'        => 'client',
>                   'activemq.prefetchSize' => 1
> });
> $stomp->subscribe({ destination => '/queue/FOO.BAR2',
>                   'ack'        => 'client',
>                   'activemq.prefetchSize' => 1
> });
>
> # read one frame, then start a transaction asking for a receipt of the
> # BEGIN message
> while ($stomp->can_read()){
>
>    my $frame = $stomp->receive_frame;
>    print STDERR "got frame ".$frame->as_string()."\n";
>
>
>    print STDERR "sending a BEGIN\n";
>    my($frame) = Net::Stomp::Frame->new({
>        command => 'BEGIN',
>            headers => {
>            transaction => 123,
>            receipt     => 456,
>        },
>    });
>
>    $stomp->send_frame($frame);
>
>    my $expected_receipt = $stomp->receive_frame;
>    print STDERR "expected RECEIPT but got
> ".$expected_receipt->as_string()."\n";
>
>    exit;
> }
>
> This outputs (with the details elided)
>
> got frame MESSAGE
> destination:/queue/FOO.BAR
> ....
>
> sending a BEGIN
>
> expected RECEIPT but got MESSAGE
> destination:/queue/FOO.BAR2
> ....
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Net-Stomp-and-transactions-and-receive-frame-tp3843640p3850526.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



-- 
http://fusesource.com
http://blog.garytully.com

Mime
View raw message