XAS::Lib::Stomp::Frame - A STOMP Frame
use XAS::Lib::Stomp::Frame; my $frame = XAS::Lib::Stomp::Frame->new( -command => $command, -headers => $headers, -body => $body, ); ... or ... my $frame = XAS:::Lib::Stomp::Frame->new(); $frame->command('MESSAGE'); $frame->header->add('destination', '/queue/foo'); $frame->body('this is the body'); ... stringification ... my $string = $frame->as_string;
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.
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:
The command verb.
Headers for this command. This supports the 'bytes_message' header which indicates a binary body.
A body for the command.
Create a buffer from the serialized frame.
my $buffer = $frame->as_string;
This returns a XAS::Lib::Stomp::Frame::Headers object. This object contains auto generated mutators of the header fields in a STOMP frame.
This get/sets STOMP frames command verb.
This get/sets the body of the STOMP frame.
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.
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.
Returns a Set::Light object of available methods.
This will add a header.
The name of the header.
The value for the header.
This will remove a header.
The name of the header to remove.
This module is based on Net::Stomp::Frame by Leon Brocard <acme@astray.com>.
For more information on the STOMP protocol, please refer to: http://stomp.github.io/ .
Kevin L. Esteb, <kevin@kesteb.us>
Copyright (C) 2014 Kevin L. Esteb
This is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. For details, see the full text of the license at http://www.perlfoundation.org/artistic_license_2_0.
To install XAS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XAS
CPAN shell
perl -MCPAN -e shell install XAS
For more information on module installation, please visit the detailed CPAN module installation guide.