Enabling No Local Delivery for a Session in the PubSub+ JCSMP API

The no local session property only affects the delivery of Direct messages to a PubSub+ JCSMP API client on the same session that the messages were published on. It does not affect the delivery of Guaranteed messages.

The no local property can also be enabled for a flow. When enabled at the flow level, the no local flow property affects the delivery of Non‑Persistent or Persistent messages on a flow that is created in the same session that the messages were published on. The delivery of Direct messages is not affected by the no local flow property. (For more information about setting the no local property on a flow, refer to No Local Delivery.)

When the no local property is enabled only for the session or only for the flow, it is possible for the event broker to change the delivery mode of a published message so that it could still be delivered to its publishing client. For example, if a client publishes a message to Topic “A”, the message cannot be delivered as a Direct message to that client when no local is enabled for the session, but if no local is not enabled for a flow bound to a Topic Endpoint with the Topic subscription “A”, the message could be delivered to that client on the flow as a Non-Persistent message. For information on how a message’s delivery mode can be changed based on a Topic match, refer to Topic Matching and Message Delivery Modes.

To enable no local delivery for a session, use JCSMPProperties.NO_LOCAL:

properties.setBooleanProperty(JCSMPProperties.NO_LOCAL, true);

For an example of how to enable the no local session property, see the NoLocalPubSub sample in the Solace Developer Hub.