NAME

Gearman::Spawner::Client::Sync - synchronous client for Gearman::Spawner::Worker workers

SYNOPSIS

$client = Gearman::Spawner::Client::Sync->new(
    job_servers => ['localhost:4730']
);

eval {
    my $result = $client->run_method(
        class  => 'MyWorker',
        method => 'sing',
        arg    => [qw( do re mi )],
    );
    say "success! result is $result";
};
if ($@) {
    say "failed because $@";
}

METHODS

Gearman::Spawner::Client::Sync->new(%options)

Creates a new client object. Options:

job_servers

(Required) Arrayref of servers to connect to.

$client->run_method(%options)

Dispatches a foreground job to a worker.

Returns the deserialized result. If an error occurs, an exception is thrown.

Options:

class

(Required) The name of the worker class.

method

(Required) The name of the method in class to call.

data

(Optional) The job-specific data to pass to the worker. Any structure that can be serialized with Storable is allowed. If omitted, undef is sent.

unique

(Optional) The opaque unique tag for coalescing jobs.

run_method_background

Dispatches a background job to a worker.

Options:

class

(Required) The name of the worker class.

method

(Required) The name of the method in class to call.

data

(Optional) The job-specific data to pass to the worker. Any structure that can be serialized with Storable is allowed. If omitted, undef is sent.

unique

(Optional) The opaque unique tag for coalescing jobs.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 39:

=over without closing =back