NAME
XAS::Lib::Stomp::Frame - A STOMP Frame
SYNOPSIS
use XAS::Lib::Stomp::Frame;
my $frame = XAS::Lib::Stomp::Frame->new(
-target => '1.0',
-command => $command,
-headers => $headers,
-body => $body,
);
... or ...
my $frame = XAS:::Lib::Stomp::Frame->new();
$frame->target('1.0');
$frame->command('MESSAGE');
$frame->header->add('destination', '/queue/foo');
$frame->body('this is the body');
... stringification ...
my $string = $frame->as_string;
DESCRIPTION
This module encapsulates a STOMP frame. STOMP is the Streaming Text Orientated Messaging Protocol (or the Protocol Briefly Known as TTMP and Represented by the symbol :ttmp). It's a simple and easy to implement protocol for working with Message Orientated Middleware from any language.
A STOMP frame consists of a command, a series of headers and a body.
METHODS
new
Create a new XAS::Lib::Stomp::Frame object:
my $frame = XAS::Lib::Stomp::Frame->new(
-command => $command,
-headers => $headers,
-body => $body,
);
It can take the following parameters:
- -target
-
Specify a STOMP protocol version number. It currently supports 1.0, 1.1 and 1.2, defaulting to 1.0.
- -command
-
The command verb.
- -headers
-
Headers for this command. This supports the 'bytes_message' header which indicates a binary body.
- -body
-
A body for the command.
as_string
Create a buffer from the serialized frame.
my $buffer = $frame->as_string;
header
This returns a XAS::Lib::Stomp::Frame::Headers object. This object contains auto generated mutators of the header fields in a STOMP frame.
MUTATORS
command
This get/sets STOMP frames command verb.
body
This get/sets the body of the STOMP frame.
XAS::Lib::Stomp::Frame::Headers
This is an internal class that auto generates mutators for the headers in a STOMP frame. Any dashes in the header names are converted to underscores for the mutators name.
Example, a header of:
content-type: test/plain
Will become the mutator content_type().
The usual way to access the headers is as follows:
my $type = $frame->header->content_type;
$frame->header->content_type('text/plain');
The following methods are also available.
devolve
This will create a hash with header/value pairs. Any underscores are converted to dashes in the headers name. Primarily used during stringification of the STOMP frame.
introspect
This will return a list of headers.
add($name, $value)
This will add a header.
remove($name)
This will remove a header.
ACKNOWLEDGEMENTS
This module is based on Net::Stomp::Frame by Leon Brocard <acme@astray.com>.
SEE ALSO
For more information on the STOMP protocol, please refer to: http://stomp.github.io/ .
AUTHOR
Kevin L. Esteb, <kevin@kesteb.us>
COPYRIGHT AND LICENSE
Copyright (C) 2014 Kevin L. Esteb
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
See http://dev.perl.org/licenses/ for more information.