PDA

View Full Version : JAMP (JSON Actor Message Protocol)


ferg
02-14-2012, 11:31 PM
I've uploaded an experimental protocol draft at JAMP: JSON Actor Message Protocol (http://hessian.caucho.com/jamp/index.xtp).

It's a simplification of earlier work we've done with Hessian and Messaging/RPC.

The basic idea is to have a message-style RPC. Unlike a plain RPC, the message style allows asynchronous sending and receiving. You can send non-RPC calls (basically methods with return void), and pipeline multiple requests, before waiting for a response. The query and reply are matched up with a query-id which serves as a correlation id.

(We'll be putting together a Hessian version as well eventually. The JSON is easier to see.)

An RPC query looks like:


["query",
8675309,
"jamp+ws://example.com/service/actor13",
"jamp+ws://example.com/client/ws513",
"my_action",
["arg1","arg2",...]]


The response looks like


["reply",
8675309,
"jamp+ws://example.com/client/ws513",
"jamp+ws://example.com/service/actor13",
"result"]


And a unidirectional message that doesn't expect a response looks like:


["send",
"jamp+ws://example.com/service/actor14",
"jamp+ws://example.com/client/ws513",
"my_action",
[arg1, arg2, ...]]



The arguments and result can be arbitrary JSON objects.

The addresses ("to" followed by "from") are typically URLs, though the spec allows for arbitrary strings. In this case, the address is jamp over WebSocket. You could also have JAMP over HTTP/REST with "jamp+http://..." or even JAMP or STOMP or JAMP or AMQP like "jamp+stomp://..." or "jamp+amqp://...".