Net::STOMP::ClientSTOMP object oriented client module | |
Download |
Net::STOMP::Client Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Publisher Name:
- Lionel Cons
- Publisher web site:
- http://search.cpan.org/~lcons/
Net::STOMP::Client Tags
Net::STOMP::Client Description
STOMP object oriented client module Net::STOMP::Client is a Perl module that provides an object oriented client interface to interact with servers supporting STOMP (Streaming Text Orientated Messaging Protocol). It supports the major features of modern messaging brokers: SSL, asynchronous I/O, receipts and transactions.SYNOPSIS # # simple producer # use Net::STOMP::Client; $stomp = Net::STOMP::Client->new(host => "127.0.0.1", port => 61613); $stomp->connect(login => "guest", passcode => "guest"); $stomp->send(destination => "/queue/test", body => "hello world!"); $stomp->disconnect(); # # consumer with client side acknowledgment # use Net::STOMP::Client; $stomp = Net::STOMP::Client->new(host => "127.0.0.1", port => 61613); $stomp->connect(login => "guest", passcode => "guest"); # declare a callback to be called for each received message frame $stomp->message_callback(sub { my($self, $frame) = @_; $self->ack(frame => $frame); printf("received: %s\n", $frame->body()); return($self); }); # subscribe to the given queue $stomp->subscribe(destination => "/queue/test", ack => "client"); # wait for a specified message frame $stomp->wait_for_frames(callback => sub { my($self, $frame) = @_; if ($frame->command() eq "MESSAGE") { # stop waiting for new frames if body is "quit" return(1) if $frame->body() eq "quit"; } # continue to wait for more frames return(0); }); $stomp->unsubscribe(destination => "/queue/test"); $stomp->disconnect(); Requirements: · Perl
Net::STOMP::Client Related Software