#!/usr/bin/perl -w use lib qw(../lib); use strict; use warnings; use Net::Stomp; my $destination = "/topic/Test.CrossDelivery"; my $stomp = Net::Stomp->new( { hostname => 'localhost', port => '61613' } ); $stomp->connect( { login => 'foo', passcode => 'bar' } ); $stomp->subscribe( { destination => $destination , 'ack' => 'client', 'activemq.prefetchSize' => 1 } ); my $count = 0; print "Waiting for subscribed messages from $destination ...\n"; while(1) { # Receive Message my $frame = $stomp->receive_frame(); print "Received Message " . ++$count . ": \'" . $frame->body() . "\'\n"; #Ack message $stomp->ack( { frame => $frame } ); #time to quit? my $control = $frame->headers()->{'control'}; if(defined($control) and $control eq "QUIT") { print "Received QUIT session control command. Exiting...\n"; last; } }