1#!perl
2use strict;
3use warnings;
4use lib 'lib';
5use Net::Stomp;
6
7my $stomp = Net::Stomp->new( { hostname => 'localhost', port => '61613' } );
8$stomp->connect( { login => 'hello', passcode => 'there' } );
9$stomp->subscribe(
10    {   destination             => '/queue/foo',
11        'ack'                   => 'client',
12        'activemq.prefetchSize' => 1,
13    }
14);
15
16while ( $stomp->can_read( { timeout => 1 } ) ) {
17    my $frame = $stomp->receive_frame;
18    $stomp->ack( { frame => $frame } );
19    warn $frame->command . ': >' . substr( $frame->body, 0, 80 ) . "<\n";
20}
21
22$stomp->disconnect;
23
24