Just a second...

Using request-response messaging

You can send request messages directly to a client session, a set of client sessions, or a message path. The recipient of a message can respond to the request.

Typed requests and responses

Each request and response messages has a data type. The data type can be one of the following types:
  • JSON
  • Binary
  • String
  • Int64
  • Double
The data type of the response is not required to be the same as the data type of the request it responds to.

When you send a request, you specify the data type of the request message and the data type of the response message it expects. When you register a handler or a stream to receive requests and respond to them, you specify the data type of the requests it receives and the data type of the responses it sends.

Data types are organized in a hierarchy of compatibility.
Figure 1. Data type hierarchy At the top of the hierarchy is the 'Bytes' data type. Below 'Bytes' are the 'JSON' and 'Binary' data types. Below the 'JSON' data type are the 'String', 'Int64', and 'Double' data types.
A request or response with a data type at a lower (more specific) level of the hierarchy can be received by a stream, handler, or requester that is expecting a message with a data type at a higher (more general) level of the hierarchy. For example, a request message with a string data type, can be received by a stream or handler that specifies string, JSON, or bytes as the request type.

Message path

The message path is made up of path segments separated by the slash character (/). Each path segment can be made up of one or more Unicode characters. The slash character (/) is not permitted in any path segment. The restrictions for message paths are the same as those for paths at which topics can be bound. For more information, see Topic naming.

However, messaging is entirely separate from streaming data through topics:
  • Message paths are unrelated topic paths. Sending a message does not change the state of any topic and does not publish the message to topic subscribers.
  • An application can bind a topic to a topic path and use the same path as a message path. This is a useful convention where the messages are related to the topic in some way. The messages sent to the message path do not interact with the topic in any way.
  • If a topic is bound to the path used by messaging, the data type of the topic does not affect the data type of any messages sent using the message path.
  • The security permissions required to use a path for messaging are separate from those required to use a topic bound to that path to stream data.

Request-response and clusters

Request-response messaging is cluster-aware. This means that a message handler attached to one server in a Diffusion™ cluster can route a message to any server within that cluster.