Creating Temporary Endpoints in the PubSub+ JCSMP API
A client using the PubSub+ JCSMP API can consume Guaranteed messages from a temporary endpoint (a temporary queue or a non-durable topic endpoint). However, a temporary endpoint is non‑durable because it only exists as for as long as the Session that it was created in.
After a client application creates a temporary endpoint instance, a matching endpoint object is automatically provisioned on the event broker when a flow is created for that temporary endpoint. To create a flow for a temporary endpoint, a client application can call JCSMPSession.createFlow(endpointToBindTo,newSubscription,messageListener)
, which returns a FlowReceiver
object.
When you call the close()
function on the FlowReceiver
, if the flow is bound to a non-durable endpoint, then the event broker deletes the non-durable endpoint and any accumulated messages.
Related Samples
For an example of how to dynamically create temporary queues, see the SimpleFlowToQueue
sample on the Solace Developer Hub.
For an example of how to dynamically create temporary topic endpoints, see the SimpleFlowToTopic
sample on the Solace Developer Hub.
To create temporary endpoints for temporary queues, use the following:
JCSMPSession.CreateTemporaryQueue()
Creates a temporary Queue with an automatically‑generated name.
JCSMPSession.CreateTemporaryQueue(String name)
Creates a temporary Queue based on the given name.
To create temporary endpoints for non-durable topic endpoints, use the following:
JCSMPSession.CreateNonDurableTopicEndpoint()
Creates a non-durable Topic Endpoint with an automatically-generated name.
JCSMPSession.CreateNonDurableTopicEndpoint(String name)
Creates a non-durable Topic Endpoint based on the given name.