NAME

Clutch::Client - distributed job system's client class

SYNOPSIS

# client script
use strict;
use warnings;
use Clutch::Client;
my $args = shift || die 'missing args';
my $client = Clutch::Client->new(
    servers => [
        +{ address => "$worker_ip:$worker_port" },
    ],
);
my $res = $client->request('echo', $args);
print $res, "\n";

METHOD

my $client = Clutch::Client->new(%opts);

$opts{servers}

The value is a reference to an array of worker addresses.

If hash reference, the keys are address (scalar), weight (positive rational number)

The server address is in the form host:port for network TCP connections

Client will distribute Data::WeightedRoundRobin.

$opts{admin_address}

inquiry workers address from admin daemon, if admin daemon starting.

$opts{timeout}

seconds until timeout (default: 10)

my $res = $client->request($function_name, $args);

$function_name

worker process function name.

$args

get over client argument for worker process.

$args must be single line data.

SEE ALSO

Data::WeightedRoundRobin