Topic Matching and Message Delivery Modes
When a PubSub+ event broker using Guaranteed messaging receives messages published to a topic, it can automatically change the delivery mode of the messages to accommodate the persistence requirements of an endpoint or a direct client subscription when there is a topic match. Changing message delivery modes is known as message promotion and demotion.
Message promotion and demotion can introduce several potential drawbacks to your deployment. Carefully consider the following limitations before deciding to implement this feature:
-
Message promotion is not guaranteed to be lossless. A Direct message publisher can send messages faster than the Guaranteed messaging path can process messages and it doesn’t have the same backpressure mechanisms as a Guaranteed publisher. In this case, the event broker aggressively discards messages on the promotion path to protect the Guaranteed messaging path.
-
Message promotion can lead to resource issues. Because a Direct message publisher can send messages faster than a Guaranteed messaging client can consume them, the disk space allocated for queues on the event broker can be quickly consumed.
-
A high rate of message promotion can impact latency for Guaranteed messaging.
-
Message demotion can result in duplicate messages. If the publishing application doesn’t receive acknowledgement from the event broker, messages are retransmitted. The event broker has built in mechanisms to prevent this retransmission for Guaranteed messaging subscribers, however Direct messaging subscribers receive additional copies.
For additional guidance, contact Solace.
Examples
Direct Message Published to a Topic Matching a Subscription Set for an Endpoint
A client application may publish a Direct message to a topic that matches a topic subscription set for a queue or a topic endpoint on the event broker. Because an endpoint can only accept Guaranteed messages (persistent and non‑persistent), the event broker changes the messageʼs delivery mode to non-persistent so that the endpoint can receive it. When a client publishes a message as Direct, the message is not acknowledged back to the client. However, when the message’s delivery mode is changed to non‑persistent and the message is spooled to the endpoint, the message then acts as a Guaranteed message and an acknowledgment from the receiving client is provided to the event broker.
For an illustration of how the delivery mode of a message published as Direct can change if it matches a topic assigned to an endpoint, see Publishing Direct Messages.
Event Broker Receives a Persistent Message Published to a Topic
When an event broker receives a persistent message published to a topic, it delivers the message to any endpoints that have matching topic subscriptions. However, because topic subscriptions registered for individual clients are for Direct messages, the event broker can change the message’s delivery mode to Direct and send it to those clients with matching topic subscriptions. In this scenario, because the client published the message as persistent, the message is acknowledged back to the publishing client.
The only way for a client to receive persistent messages is to either bind to a durable topic endpoint or queue, or request that a non-durable queue or topic endpoint be created for it.
For an illustration of how the delivery mode of a message published as non‑persistent or persistent can change if it matches a client’s topic subscription, see Publishing Guaranteed Messages.
How Message Delivery Modes Can Change for Endpoints with Matching Topics
The following table lists how messages’ delivery modes can be changed for endpoints with matching topics.
Delivery Mode of Published Message | Received by Endpoint as ... |
---|---|
Direct | Non-Persistent |
Non-Persistent | Non-Persistent |
Persistent | Persistent |