App::MessageDispatcher - Interface for sending/receiving (possibly) async messages


App-Context documentation Contained in the App-Context distribution.

Index


Code Index:

NAME

Top

App::MessageDispatcher - Interface for sending/receiving (possibly) async messages

SYNOPSIS

Top

    use App;

    $context = App->context();
    $messaging = $context->service("MessageDispatcher");  # or ...
    $messaging = $context->messaging();

    ($status, $ticket) = $messaging->send(
        recipient => $recipient,
        message => $message
    );

    $message = $messaging->receive();

    $message = $messaging->receive(
        sender => $sender,
    );

    $message = $messaging->receive(
        ticket => $ticket,
    );

DESCRIPTION

Top

A MessageDispatcher service is a means by which data can be sent asynchronously (or synchronously) to a recipient and responses can be received.

Because the possibility exists for the messaging channel to be asynchronous, code that uses a MessageDispatcher service must code for the most complicated case (asynchronous).

Class Group: MessageDispatcher

Top

The following classes might be a part of the MessageDispatcher Class Group.

* Class: App::MessageDispatcher
* Class: App::MessageDispatcher::Mail
* Class: App::MessageDispatcher::SOAP
* Class: App::MessageDispatcher::Stem
* Class: App::MessageDispatcher::Spread
* Class: App::MessageDispatcher::Jabber
* Class: App::MessageDispatcher::PVM
* Class: App::MessageDispatcher::MPI

Class: App::MessageDispatcher

Top

A MessageDispatcher service is a means by which data can be sent synchronously or asynchronously to a recipient and responses can be received.

 * Throws: App::Exception::MessageDispatcher
 * Since:  0.01

Class Design

...

Constructor Methods:

Top

new()

The constructor is inherited from App::Service|App::Service/"new()".

Public Methods:

Top

send()

    * Signature: ($status, $ticket) = $messaging->send(%named);
    * Param:     recipient          string
    * Param:     message            binary
    * Return:    $status            integer
    * Return:    $ticket            string
    * Throws:    App::Exception::MessageDispatcher
    * Since:     0.01

    Sample Usage: 

    ($status, $ticket) = $messaging->send(
        recipient => "spadkins\@gmail.com",
        message => "Hello.",
    );

receive()

    * Signature: $message = $messaging->receive();
    * Signature: $message = $messaging->receive(%named);
    * Param:     sender          string
    * Param:     ticket          string
    * Return:    $message        binary
    * Throws:    App::Exception::MessageDispatcher
    * Since:     0.01

    Sample Usage: 

    # receive next available message
    $message = $messaging->receive();

    # receive next message from sender
    $message = $messaging->receive(
        sender => "spadkins\@gmail.com",
    );

    # receive message associated with ticket
    $message = $messaging->receive(
        ticket => "XP305-3jks37sl.f299d",
    );

Protected Methods:

Top

service_type()

Returns 'MessageDispatcher'.

    * Signature: $service_type = App::MessageDispatcher->service_type();
    * Param:     void
    * Return:    $service_type  string
    * Since:     0.01

    $service_type = $mdisp->service_type();

ACKNOWLEDGEMENTS

Top

 * Author:  Stephen Adkins <spadkins@gmail.com>
 * License: This is free software. It is licensed under the same terms as Perl itself.

SEE ALSO

Top

App::Context|App::Context, App::Service|App::Service


App-Context documentation Contained in the App-Context distribution.
#############################################################################
## $Id: MessageDispatcher.pm 6783 2006-08-11 17:43:28Z spadkins $
#############################################################################

package App::MessageDispatcher;
$VERSION = (q$Revision: 6783 $ =~ /(\d[\d\.]*)/)[0];  # VERSION numbers generated by svn

use App;
use App::Service;
@ISA = ( "App::Service" );

use strict;

#############################################################################
# CLASS GROUP
#############################################################################

#############################################################################
# CLASS
#############################################################################

#############################################################################
# CONSTRUCTOR METHODS
#############################################################################

#############################################################################
# new()
#############################################################################

#############################################################################
# PUBLIC METHODS
#############################################################################

#############################################################################
# send()
#############################################################################

sub send {
    my $self = shift;
    my %args = @_;
    my ($status, $ticket);
    ($status, $ticket);
}

#############################################################################
# receive()
#############################################################################

sub receive {
    my $self = shift;
    my %args = @_;
}

#############################################################################
# PROTECTED METHODS
#############################################################################

#############################################################################
# Method: service_type()
#############################################################################

sub service_type () { 'MessageDispatcher'; }

1;