Intro to JAMP

json-amp edited this page Mar 16, 2012 · 13 revisions

JAMP Home, Wiki Home, Visual tutorial, Language Mappings, Marshaling, and Routing, WebSocket Intro, WebSocket versus Ajax and REST

Intro to JAMP

This is basic intro to JAMP.

JAMP stands for JSON (JavaScript Object Notation) Actor Message Protocol. JAMP is a serialization protocol, routing protocol for messaging targeting WebSocket, REST, AMQP and STOMP. JAMP is geared towards SOA services.

Vision of JAMP

Vision of JAMP is cross languages communication, routing and marshaling via JSON over multiple SOA and messaging protocols.

JSON-AMP JAMP Vision of JAMP

Message types

JAMP supports four types of messages.

JSON-AMP JAMP Message Types

Send Message

A send is a unidirectional message. JAMP "send" message has these parts. JSON-AMP JAMP Message Send Type

Query

A "query" is a bidirectional request for a response.
The receiver of a "query" message must respond with a "reply" or "error-query" message.

JSON-AMP JAMP Message Query Type

The error object always has a type and message field. The reply object can be any JSON type.

Error

The 'error' message is a general error in response to any message. It can be used to inform a client of service availability.

JSON-AMP JAMP Message Error Type

  ["error",
   "jamp+ws://source.example.com/my-actor",
   "jamp+ws://target.example.com/my-service",
   {"type": "service-not-found",
    "message": "'my-service' is an unknown service"}]

Sample Query Interaction Happy Case (result)

Let's say an HTML 5 client sent the following query message via websockets to the math-service.

  ["query",
   12345,
   "jamp+http://somehost/math-service",
   "jamp+ws://otherhost/client123",
   "add",
   [1, 2]]

The above says send the action add to the service called math-service passing the arguments 1 and 2.

Now the math-service responds with the following:


  ["reply",
   12345,
   "jamp+ws://otherhost/client123",
   "jamp+http://somehost/math-service",
   3]

Thus the results of math-service.add(1,2) is 3.

Sample Query Interaction Error Case (result)

Let's say an HTML 5 client sent the following erroneous query message via websockets to the math-service.

  ["query",
   12345,
   "jamp+http://somehost/math-service",
   "jamp+ws://otherhost/client123",
   "add",
   ["apple", 2]]

The above says send the action add to the service called math-service passing the arguments "apple" and 2.

Now the math-service responds with the following error:


  ["error-query",
   12345,
   "jamp+ws://otherhost/client123",
   "jamp+http://somehost/math-service",
   { 
       type : "Math Error from math-service",
       message : "The value 'apple' is not a valid number"
   }]

JAMP Home, Wiki Home, Visual tutorial, Language Mappings, Marshaling, and Routing,