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

NAME

Argon::Client

SYNOPSIS

    use Argon::Client;

    my $client = Argon::Client->new(port => 8000, host => 'some.host.name');
    $client->connect;
    my $result = $client->process(
        class  => 'Some::Class', # with Argon::Role::Task
        params => [ foo => 'bar', baz => 'bat' ],
    );

DESCRIPTION

Argon::Client provides a client connection to an Argon::Node or Argon::Cluster instance and a simple API for sending tasks and retrieving the results.

METHODS

new(port => ..., host => ...)

Creates a new Argon::Client that will connect to host:port. Port must be a valid port number and host a valid hostname to which the current system can connect.

connect()

Creates a connection to the remote host. An error is thrown if the connection fails.

process(class => '...', params => [...], priority => PRI_HIGH)

Queues a task on the remote host and returns the results. If the task resulted in an error, it is rethrown here. Otherwise, the result of calling the run method of the class passed as an argument. Params expects an array ref of arguments to be passed to class's constructor (although they may be in the form of hash arguments, e.g. [foo = 'bar']>).

By default, tasks are sent with a priority of PRI_NORMAL. This may be controlled via the priority parameter.

Due to Argon's architecture, an overloaded system will reject tasks rather than create a large backlog. When this happens, Argon::Client silently retries the task indefinitely until it is accepted and completed. To control this behavior, the optional parameter retries may be specified to limit the number of retries.

AUTHOR

Jeff Ober mailto:jeffober@gmail.com

LICENSE

BSD license