#!/usr/bin/perl -w use lib qw(../lib); use strict; use warnings; use Net::Stomp; my $stomp = Net::Stomp->new( { hostname => 'localhost', port => '61613' } ); $stomp->connect( { login => 'foo', passcode => 'bar' } ); my $maxIterations = 4; my $destination = "/topic/Test.CrossDelivery"; if(@ARGV) { $maxIterations = $ARGV[0]; } my $frame; print "Publishing messages to $destination ...\n"; for(my $i=1; $i <= $maxIterations; $i++) { my $message = "Test Message " . $i; $frame = Net::Stomp::Frame->new( { command => 'SEND', headers => { 'destination' => $destination, 'timestamp' => time }, body => $message } ); $stomp->send_frame($frame); print "Published Message " . $i . " :\'" . $message . "\.\n"; } $frame = Net::Stomp::Frame->new( { command => 'SEND', headers => { 'destination' => $destination, 'timestamp' => time, 'control' => 'QUIT' }, body => "Time to Quit Conversation" } ); $stomp->send_frame($frame); $stomp->disconnect();