java.lang.Object | ||
↳ | com.rabbitmq.client.RpcClient | |
↳ | com.rabbitmq.tools.jsonrpc.JsonRpcClient |
JSON-RPC
is a lightweight RPC mechanism using JSON as a data language for
request and reply messages. It is rapidly becoming a
standard in web development, where it is used to make RPC
requests over HTTP. RabbitMQ provides an AMQP transport
binding for JSON-RPC in the form of
the JsonRpcClient
class.
JSON-RPC services are self-describing - each service is able
to list its supported procedures, and each procedure
describes its parameters and types. An instance of
JsonRpcClient retrieves its service description using the
standard system.describe
procedure when it is
constructed, and uses the information to coerce parameter
types appropriately. A JSON service description is parsed
into instances of ServiceDescription
. Client
code can access the service description by reading the
serviceDescription
field of
JsonRpcClient
instances.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.rabbitmq.client.RpcClient
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Construct a new JsonRpcClient, passing the parameters through
to RpcClient's constructor.
| |||||||||||
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public API - builds, encodes and sends a JSON-RPC request, and
waits for the response.
| |||||||||||
Public API - as
call(String, Object[]) , but takes the
method name from the first entry in args , and the
parameters from subsequent entries. | |||||||||||
Private API - parses a JSON-RPC reply object, checking it for exceptions.
| |||||||||||
Private API - used by
call(String[]) to ad-hoc convert
strings into the required data types for a call. | |||||||||||
Public API - gets a dynamic proxy for a particular interface class.
| |||||||||||
Public API - gets the service description record that this
service loaded from the server itself at construction time.
| |||||||||||
Public API - implements InvocationHandler.invoke.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.rabbitmq.client.RpcClient
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
java.lang.reflect.InvocationHandler
|
Construct a new JsonRpcClient, passing the parameters through to RpcClient's constructor. The service description record is retrieved from the server during construction.
TimeoutException | if a response is not received within the timeout specified, if any |
---|---|
IOException | |
JsonRpcException |
Public API - builds, encodes and sends a JSON-RPC request, and waits for the response.
JsonRpcException | if the reply object contained an exception |
---|---|
TimeoutException | if a response is not received within the timeout specified, if any |
IOException |
Public API - as call(String, Object[])
, but takes the
method name from the first entry in args
, and the
parameters from subsequent entries. All parameter values are
passed through coerce() to attempt to make them the types the
server is expecting.
JsonRpcException | if the reply object contained an exception |
---|---|
NumberFormatException | if a coercion failed |
TimeoutException | if a response is not received within the timeout specified, if any |
IOException |
Private API - parses a JSON-RPC reply object, checking it for exceptions.
JsonRpcException |
---|
Private API - used by call(String[])
to ad-hoc convert
strings into the required data types for a call.
NumberFormatException |
---|
Public API - gets a dynamic proxy for a particular interface class.
IllegalArgumentException |
---|
Public API - gets the service description record that this service loaded from the server itself at construction time.
Public API - implements InvocationHandler.invoke. This is useful for constructing dynamic proxies for JSON-RPC interfaces.
Throwable |
---|