use Net::Stomp;
my $hostname = 'localhost';
warn "Creating stomp object";
my $stomp = Net::Stomp->new( { hostname => $hostname, port => '61613' } );
warn "Connecting";
$stomp->connect( { login => 'guest', passcode => 'password' } );
warn "Subscribing";
$stomp->subscribe( { destination => '/queue/example.A',
'activemq.prefetchSize' => 1 });
while ( $stomp->can_read ){
warn "Getting frame";
my $frame = $stomp->receive_frame ( { timeout => 0.5 } ) || die 'frame timeout';
warn 'Got frame: ' . $frame->body;
}
$stomp->disconnect;
warn "Disconnected";
####
Got frame: This is message 10 at ./stomp_consumer.pl line 26.
Getting frame at ./stomp_consumer.pl line 24.
####
while ( $stomp->can_read ( {timeout => 0.5 } ) ){
# do stuff
}