JobCenter::Client::Mojo - JobCenter JSON-RPC 2.0 Api client using Mojo.
use JobCenter::Client::Mojo; my $client = JobCenter::Client::Mojo->new( address => ... port => ... who => ... token => ... ); my ($job_id, $outargs) = $client->call( wfname => 'test', inargs => { test => 'test' }, );
JobCenter::Client::Mojo is a class to build a client to connect to the JSON-RPC 2.0 Api of the JobCenter workflow engine. The client can be used to create and inspect jobs as well as for providing 'worker' services to the JobCenter.
$client = JobCenter::Client::Mojo->new(%arguments);
Class method that returns a new JobCenter::Client::Mojo object.
Valid arguments are:
(default: 127.0.0.1)
(default 6522)
(default false)
(required)
(default: password)
(default: false)
when true expects the inargs to be valid json, when false a perl hashref is expected and json encoded. (default true)
(per default a new Mojo::Log object is created)
(default 60 seconds)
($job_id, result) = $client->call(%args);
Creates a new JobCenter job and waits for the results. Throws an error if somethings goes wrong immediately. Errors encountered during later processing are returned as a JobCenter error object.
$job_id = $client->call_nb(%args);
Creates a new JobCenter job and call the provided callback on completion of the job. Throws an error if somethings goes wrong immediately. Errors encountered during later processing are returned as a JobCenter error object to the callback.
Valid arguments are those for call and:
( cb => sub { ($job_id, $outargs) = @_; ... } )
Announces the capability to do an action to the Api. The provided callback will be called when there is a task to be performed. Returns an error when there was a problem announcing the action.
my $err = $client->announce( actionname => '...', cb => sub { ... }, ); die "could not announce $actionname?: $err" if $err;
See jcworker for an example.
(default 1)
Starts the Mojo::IOLoop.
Mojo::IOLoop, Mojo::IOLoop::Stream, http://mojolicious.org: the Mojolicious Web framework
"jcclient" in examples, "jcworker" in examples
https://github.com/a6502/JobCenter: JobCenter Orchestration Engine
1 POD Error
The following errors were encountered while parsing the POD:
'=item' outside of any '=over'
=over without closing =back
To install JobCenter::Client::Mojo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm JobCenter::Client::Mojo
CPAN shell
perl -MCPAN -e shell install JobCenter::Client::Mojo
For more information on module installation, please visit the detailed CPAN module installation guide.