Basic Operation of Guaranteed Messaging
The following figure shows the basic steps in the handling of Guaranteed Messages from a publishing to a consuming client.
- Publish message
- Spool message
- Ack message spooled
- Receive message
A client application that has connected to a Message VPN on a Solace PubSub+ event broker publishes a Guaranteed message (that is, a message with a delivery mode of persistent or non-persistent) to a topic or queue destination.
The ingress message received by the event broker is spooled to a queue or topic endpoint.
An acknowledgment that the message has been successfully spooled is sent back to the publishing client.
The event broker can deliver the spooled message to a consuming client if that client:
- has successfully established a connection to the same Message VPN;
- is authorized to receive Guaranteed messages;
- has created a consumer flow in that session to bind to the endpoint;
- has an active flow. That is, out of all the flows currently bound to that endpoint, that client's flow can deliver messages. For more information about access types refer to Queue Access Types and Topic Endpoints.
After the event broker delivers the message to the consumer, an acknowledgment that the message has been successfully delivered is sent back to the event broker by the consuming client, and then the event broker deletes the message from the message spool.
For more information on the message spooling and acknowledgment mechanism, refer to Message Spooling.
Sessions and Consumer Flows
When applications are using Solace APIs, a session is used to provide a client connection between an application and an event broker. A session uses a single TCP connection to the event broker. A session is required for all client messaging operations: for example, a session is required to publish Guaranteed messages, and a session is required to create a consumer flow through which Guaranteed messages can be received.
A consumer flow can be created in a session to establish a one‑to‑one mapping of a consumer to a queue or topic endpoint. Consumer flows provide a means of transport for Guaranteed messages from the event broker to the consumer. One or more consumer flows can be created in a session.
Consumer flows are not used to receive Direct messages. Instead, clients receive Direct messages published to a topic that matches the clients’ subscriptions directly from the event broker’s message bus through sessions.