REST Producers

Sending messages to a Solace router is accomplished with a REST publishing client. A REST publishing client is authenticated when a connection is established. In general, it is recommended that applications use HTTP 1.1 persistent connections to allow for higher performance sending by avoiding the need to establish a connection for each message send action.

One-way POST to Solace

When the application sends a message and no reply is expected, producers send an HTTP POST request containing all the relevant message headers, properties, and contents. The Solace router converts this message to the internal Solace Message Format (SMF) for routing and sends back an HTTP 200 OK response when the message is successfully accepted by the Solace router. For persistent messages, the 200 OK is returned after the message has been successfully stored on the Solace router.

The format of the REST POST request is outlined in Solace REST Messaging Protocol in Section 2 “Solace REST Message Encoding”.

Request / Reply to Solace

When an application sends a request and expects a reply, the Solace REST messaging provides two options:

  1. A blocking exchange where the Solace router correlates the request and reply together for the application.
  2. An asynchronous exchange, and the reply is received later.

Synchronous Request/Reply

In the synchronous case, when the Solace router receives the HTTP POST request, it delays returning the HTTP response. This allows the Solace router to send the request out on the Solace message bus, waiting for a reply to be received before responding to the REST consumer. When a reply is received or the request times out, the Solace router responds to the REST producer. This exchange is shown in the following figure.

Synchronous Request Reply

The body of the HTTP response carries the contents of the response, as outlined in Solace REST Message Encoding.

Asynchronous Request/Reply

The Solace REST messaging feature also provides publishers the option of specifying a destination for replies. In this way, REST applications can send a message to a Solace router and receive a reply later using the specified reply-to destination. This exchange is shown in the following figure.

With asynchronous request/reply, the REST application is both a REST producer and a REST consumer. The request is published to the Solace router normally, and the REST producer receives the 200 OK when the Solace router accepts the message. When the JMS application sends the reply, the Solace router sends the reply to the REST application on a separate HTTP connection as a new HTTP POST request. The REST application responds with a final 200 OK response to acknowledge receipt of the reply.

The REST application can specify a correlation ID in the message to correlate the request with the response that is received asynchronously.