REST Messaging Protocol
This section describes the Solace Representational State Transfer (REST) messaging protocol and message exchange patterns that will be encountered in common use cases.
REST is a lightweight way of designing network applications. Solace REST messaging can be used to integrate external HTTP REST clients and other network appliances that have built-in support for REST-like messaging with Solace PubSub+.
Solace REST messaging makes use of bi-directional HTTP POST requests to exchange messages in both directions as shown in the following figure. This enables REST clients to send messages to and receive messages from any Solace PubSub+ event broker clients.
REST producers send message contents in the body of an HTTP POST request. For request/reply scenarios, the response contents are carried in the body of the HTTP 200 OK responses. For REST consumers, the event broker sends the message in the body of an HTTP POST request. And again for request/reply scenarios, the response contents are carried in the HTTP 200 OK responses.
The use of HTTP POST requests in both directions has several benefits. It removes the possibility of message loss which can exist when using HTTP GET requests to poll for messages. It also enables much higher performance and overall message rate when multiple, parallel HTTP connections are used.
Solace REST Highlights
The following is a list of some of the key aspects of the Solace REST Protocol:
- the REST Service is controlled per Message VPN
- REST access Ports are also configured per Message VPN
- it supports HTTP 1.1 persistent connections for efficient messaging
- it supports HTTP and HTTPS message traffic
- it supports sending messages as an HTTP client
- it supports receiving messages as an HTTP server
- it supports basic and client certificate authentication
- it inter-operates with all other Solace clients
There are two main actors in the Solace REST protocol:
- REST Producer—sends messages to the Solace PubSub+ event broker
- REST Consumer—receives messages from the Solace PubSub+ event broker
REST producers are applications that send REST messages to a topic or queue within a Message VPN on a Solace PubSub+ event broker. For REST producers to send messages to an event broker, they must establish a client connection to the event broker and be authenticated.
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.
For physical client applications to consume REST messages from Solace PubSub+, the event broker will establish an HTTP connection to the consumer application and send messages to it using an HTTP POST request as seen in the following figure.
The REST application acknowledges receipt of the message through a 200 OK HTTP response back to the event broker.
To receive messages from the event broker, REST Delivery Points (RDPs) must be configured to provide the event broker with details on how to deliver the messages.