File: subscribe.pl

package info (click to toggle)
libnet-stomp-perl 0.62-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 224 kB
  • sloc: perl: 1,311; makefile: 7
file content (23 lines) | stat: -rw-r--r-- 591 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!perl
use strict;
use warnings;
use lib 'lib';
use Net::Stomp;

my $stomp = Net::Stomp->new( { hostname => 'localhost', port => '61613' } );
$stomp->connect( { login => 'hello', passcode => 'there' } );
$stomp->subscribe(
    {   destination             => '/queue/foo',
        'ack'                   => 'client',
        'activemq.prefetchSize' => 1,
    }
);

while ( $stomp->can_read( { timeout => 1 } ) ) {
    my $frame = $stomp->receive_frame;
    $stomp->ack( { frame => $frame } );
    warn $frame->command . ': >' . substr( $frame->body, 0, 80 ) . "<\n";
}

$stomp->disconnect;