.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. | will give a .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' .\" expand to `' in nroff, nothing in troff, for use with C<>. .tr \(*W-|\(bv\*(Tr .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Net::Stomp 3" .TH Net::Stomp 3 "2008-01-09" "perl v5.8.8" "User Contributed Perl Documentation" .SH "NAME" Net::Stomp \- A Streaming Text Orientated Messaging Protocol Client .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 7 \& # send a message to the queue 'foo' \& use Net::Stomp; \& my $stomp = Net::Stomp->new( { hostname => 'localhost', port => '61613' } ); \& $stomp->connect( { login => 'hello', passcode => 'there' } ); \& $stomp->send( \& { destination => '/queue/foo', body => 'test message' } ); \& $stomp->disconnect; .Ve .PP .Vb 16 \& # subscribe to messages from the queue 'foo' \& 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 (1) { \& my $frame = $stomp->receive_frame; \& warn $frame->body; # do something here \& $stomp->ack( { frame => $frame } ); \& } \& $stomp->disconnect; .Ve .PP .Vb 4 \& # write your own frame \& my $frame = Net::Stomp::Frame->new( \& { command => $command, headers => $conf, body => $body } ); \& $self->send_frame($frame); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module allows you to write a Stomp client. Stomp is the Streaming Text Orientated Messaging Protocol (or the Protocol Briefly Known as \&\s-1TTMP\s0 and Represented by the symbol :ttmp). It's a simple and easy to implement protocol for working with Message Orientated Middleware from any language. Net::Stomp is useful for talking to Apache ActiveMQ, an open source (Apache 2.0 licensed) Java Message Service 1.1 (\s-1JMS\s0) message broker packed with many enterprise features. .PP A Stomp frame consists of a command, a series of headers and a body \- see Net::Stomp::Frame for more details. .PP For details on the protocol see . .PP To enable the ActiveMQ Broker for Stomp add the following to the activemq.xml configuration: .PP .Vb 3 \& \& \& .Ve .PP For details on Stomp in ActiveMQ See . .SH "METHODS" .IX Header "METHODS" .Sh "new" .IX Subsection "new" The constructor creates a new object. You must pass in a hostname and a port: .PP .Vb 1 \& my $stomp = Net::Stomp->new( { hostname => 'localhost', port => '61613' } ); .Ve .Sh "connect" .IX Subsection "connect" This connects to the Stomp server. You must pass in a login and passcode. .PP You may pass in 'client\-id', which specifies the \s-1JMS\s0 Client \s-1ID\s0 which is used in combination to the activemqq.subscriptionName to denote a durable subscriber. .PP .Vb 1 \& $stomp->connect( { login => 'hello', passcode => 'there' } ); .Ve .Sh "send" .IX Subsection "send" This sends a message to a queue or topic. You must pass in a destination and a body. .PP .Vb 2 \& $stomp->send( \& { destination => '/queue/foo', body => 'test message' } ); .Ve .PP To send a BytesMessage, you should set the field 'bytes_message' to 1. .Sh "disconnect" .IX Subsection "disconnect" This disconnects from the Stomp server: .PP .Vb 1 \& $stomp->disconnect; .Ve .Sh "subscribe" .IX Subsection "subscribe" This subscribes you to a queue or topic. You must pass in a destination. .PP The acknowledge mode defaults to 'auto', which means that frames will be considered delivered after they have been sent to a client. The other option is 'client', which means that messages will only be considered delivered after the client specifically acknowledges them with an \s-1ACK\s0 frame. .PP Other options: .PP \&'selector': which specifies a \s-1JMS\s0 Selector using \s-1SQL\s0 92 syntax as specified in the \s-1JMS\s0 1.1 specificiation. This allows a filter to be applied to each message as part of the subscription. .PP \&'activemq.dispatchAsync': should messages be dispatched synchronously or asynchronously from the producer thread for non-durable topics in the broker. For fast consumers set this to false. For slow consumers set it to true so that dispatching will not block fast consumers. .PP \&'activemq.exclusive': Would I like to be an Exclusive Consumer on a queue. .PP \&'activemq.maximumPendingMessageLimit': For Slow Consumer Handlingon non-durable topics by dropping old messages \- we can set a maximum pending limit which once a slow consumer backs up to this high water mark we begin to discard old messages. .PP \&'activemq.noLocal': Specifies whether or not locally sent messages should be ignored for subscriptions. Set to true to filter out locally sent messages. .PP \&'activemq.prefetchSize': Specifies the maximum number of pending messages that will be dispatched to the client. Once this maximum is reached no more messages are dispatched until the client acknowledges a message. Set to 1 for very fair distribution of messages across consumers where processing messages can be slow. .PP \&'activemq.priority': Sets the priority of the consumer so that dispatching can be weighted in priority order. .PP \&'activemq.retroactive': For non-durable topics do you wish this subscription to the retroactive. .PP \&'activemq.subscriptionName': For durable topic subscriptions you must specify the same clientId on the connection and subscriberName on the subscribe. .PP .Vb 6 \& $stomp->subscribe( \& { destination => '/queue/foo', \& 'ack' => 'client', \& 'activemq.prefetchSize' => 1 \& } \& ); .Ve .Sh "unsubscribe" .IX Subsection "unsubscribe" This unsubscribes you to a queue or topic. You must pass in a destination: .PP .Vb 1 \& $stomp->unsubcribe({ destination => '/queue/foo' }); .Ve .Sh "receive_frame" .IX Subsection "receive_frame" This blocks and returns you the next Stomp frame. .PP .Vb 2 \& my $frame = $stomp->receive_frame; \& warn $frame->body; # do something here .Ve .PP The header bytes_message is 1 if the message was a BytesMessage. .Sh "can_read" .IX Subsection "can_read" This returns whether a frame is waiting to be read. Optionally takes a timeout in seconds: .PP .Vb 2 \& my $can_read = $stomp->can_read; \& my $can_read = $stomp->can_read({ timeout => '0.1' }); .Ve .Sh "ack" .IX Subsection "ack" This acknowledges that you have received and processed a frame (if you are using client acknowledgements): .PP .Vb 1 \& $stomp->ack( { frame => $frame } ); .Ve .Sh "send_frame" .IX Subsection "send_frame" If this module does not provide enough help for sending frames, you may construct your own frame and send it: .PP .Vb 4 \& # write your own frame \& my $frame = Net::Stomp::Frame->new( \& { command => $command, headers => $conf, body => $body } ); \& $self->send_frame($frame); .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" Net::Stomp::Frame. .SH "AUTHOR" .IX Header "AUTHOR" Leon Brocard . .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (C) 2006, Leon Brocard .PP This module is free software; you can redistribute it or modify it under the same terms as Perl itself.