NAME

XAS::Lib::Stomp::Frame - A STOMP Frame

SYNOPSIS

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;

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:

-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;

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.

$name

The name of the header.

$value

The value for the header.

remove($name)

This will remove a header.

$name

The name of the header to remove.

ACKNOWLEDGEMENTS

This module is based on Net::Stomp::Frame by Leon Brocard <acme@astray.com>.

SEE ALSO

XAS

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 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.