The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

POE::Component::Server::AsyncEndpoint::ChannelAdapter::Stomp

SYNOPSIS

When you init your Endpoint:

        # Sample Outbound STOMP Client
        my $stc = POE::Component::Server::AsyncEndpoint::ChannelAdapter::Stomp->spawn({
            Alias         => $Alias . '_STC',
            mq_address    => $self->{config}->mq_address,
            mq_port       => $self->{config}->mq_port,
            queue         => '/queue/ob_sample',
            direction     => 'OB',
            user          => $self->{config}->stcuser,
            pass          => $self->{config}->stcpass,
            rcpt_callback => {
                to_session => $Alias,
                to_handler => 'RCPT_OB_Sample',
            },
        });

Later in your Endpoint:

        my $nframe = $stc->stomp->send({
            destination => $stc->config('Queue'),
            data        => $your_data,
            receipt     => $your_message_id,
        });

        $kernel->call( $stc->config('Alias'), 'send_data', $nframe );

DESCRIPTION

This class is mainly a wrapper around POE::Component::Client::Stomp that not only simplifies it's use in your Endpoint, but also enforces certain rules so the implementation complies with the Channel Adapter design pattern. For example if you initialize an Outbound STOMP client it will refuse to initialize until you have defined a callback for the STOMP/RECEIPT, if it's an IB client it will refuse to initialize if you don't define a callback to handle received data from the queue.

Methods

spawn

Parameters:

    Alias:      An alias for the STOMP client session. It should be set
                to the Endpoint's Alias with a suffix as such: $Alias . '_STC',

    mq_address: The IP address of the message queue where you will 
                publish or subscribe to.

    mq_port:    The IP port of the above address.

    queue:      The MQ queue name. Example: '/queue/ob_sample',

    direction:  Must be 'OB' or 'IB' for Outbound and Inbound respectively.

    user:       STOMP User

    pass:       STOMP Password

If it's an Outbound client you must define a callback for the STOMP/RECEIPT. The parameter is rcpt_callback and it will expect a hash ref with two parameters: to_session and to_handler.

    to_session: Specifies to which POE session the STOMP events should be
                posted to.

    to_handler: Specifies the object method that will be called when the
                client gets a RECEIPT.

    For example:

        rcpt_callback => {
            to_session => $Alias, #post to our Endpoint session...
            to_handler => 'RCPT_OB_Sample', # ...to this object method
        },

If it's an Inbound client you must define a callback when data is received from the queue. The parameter is rx_callback and will expect a hash ref with the same parameters as above.

    For example:

        rx_callback => {
            to_session => $Alias,
            to_handler => 'IB_Sample',
        },

SEE ALSO

POE::Component::Client::Stomp

POE::Component::Server::AsyncEndpoint::ChannelAdapter::SOAP POE::Component::Server::AsyncEndpoint::ChannelAdapter::Config

POE::Component::Server::AsyncEndpoint POE

AUTHOR

Alejandro Imass <ait@p2ee.org> Alejandro Imass <aimass@corcaribe.com>

COPYRIGHT AND LICENSE

Copyright (C) 2008 by Alejandro Imass / Corcaribe Tecnología C.A. for the P2EE Project

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.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 282:

You forgot a '=back' before '=head1'

Around line 299:

Non-ASCII character seen before =encoding in 'Tecnología'. Assuming UTF-8