Beekeeper::JSONRPC::Request - Representation of a JSON-RPC request
Version 0.09
my $client = Beekeeper::Client->instance; my $req = $client->call_remote_async( method => 'myapp.svc.foo', params => { foo => 'bar' }, ); $client->wait_async_calls; die unless ($req->success); print $req->result;
Objects of this class represent a JSON-RPC request (see http://www.jsonrpc.org/specification).
The method Beekeeper::Client::call_remote_async returns objects of this class.
On worker classes the method handlers setted by Beekeeper::Worker::accept_remote_calls will receive these objects as parameters.
Returns a string with the name of the method invoked.
Returns the arbitrary data structure passed as parameters.
A value of any type, which is used to match responses with requests.
Once the request is complete, it returns the corresponding Beekeeper::JSONRPC::Response or Beekeeper::JSONRPC::Error object.
Once the request is complete, it returns the result encapsulated in the response.
It is just a shortcut for $req->response->result.
$req->response->result
Once the request is complete, it returns true unless the response is an error. It is used to determine if a method was executed successfully or not ($response->result cannot be trusted as it may be undefined on success).
$response->result
Returns undef if the request is in still progress.
It is just a shortcut for $req->response->success.
$req->response->success
Returns a hashref containing the MQTT properties of the request.
On worker classes remote calls can be processed concurrently by means of calling $req->async_response to tell Beekeeper that the response for the request will be deferred until it is available, freeing the worker to accept more requests.
$req->async_response
Once the response is ready, it must be sent back to the caller with $req->send_response.
$req->send_response
Send back to the caller the provided value or data structure as response.
Error responses can be returned sending Beekeeper::JSONRPC::Error objects.
Beekeeper::Client, Beekeeper::Worker.
José Micó, jose.mico@gmail.com
jose.mico@gmail.com
Copyright 2015-2021 José Micó.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language itself.
This software is distributed in the hope that it will be useful, but it is provided “as is” and without any express or implied warranties. For details, see the full text of the license in the file LICENSE.
To install Beekeeper, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Beekeeper
CPAN shell
perl -MCPAN -e shell install Beekeeper
For more information on module installation, please visit the detailed CPAN module installation guide.