Provisioning and Deprovisioning Durable Endpoints in the PubSub+ JCSMP API
There are two ways that durable queues or topic endpoints can be provisioned on an event broker:
- An administrator can manually provision a durable endpoint through the Broker Manager, SEMP, the Solace CLI, or SolAdmin.
- Even for administrator provisioned endpoints, the PubSub+ JCSMP API, which is object-oriented, requires you to create a logical queue or topic endpoint instance to use when creating a consumer flow.
- In a connected session, a client can dynamically provision a durable endpoint through the PubSub+ JCSMP API. To dynamically provision a durable endpoint, call the method listed below and pass in endpoint properties and provision flags. For more information, see Defining Endpoint Properties in the PubSub+ JCSMP API.
Clients can provision durable endpoints through the API without immediately creating consuming Flows to them.
For an example of how to dynamically provision durable endpoints, see the QueueProvisionAndBrowse.java sample on the Solace Developer Hub.
Provisioning Durable Endpoints Using the PubSub+ JCSMP API
To dynamically provision a durable endpoint using the PubSub+ JCSMP API, complete the following steps:
- Create a local API representation of an endpoint. For the JCSMP API, this is a queue or endpoint object.
- Pass the object or property list to the appropriate method or function to provision the endpoint or queue on the event broker.
The following code snippet shows how to create an API representation of a durable endpoint or queue and provision it on the event broker:
// Create local queue or endpoint object: JCSMPFactory.createQueue(...) JCSMPFactory.createDurableTopicEndpoint(...) // Provision the queue or endpoint on the event broker: JCSMPSession.provision(...)
For more information, see the PubSub+ Messaging API for JCSMP reference.
Deprovisioning Durable Endpoints Using the PubSub+ JCSMP API
You can deprovision durable endpoints in two ways:
- An administrator can remove a durable endpoint on an event broker through the Broker Manager, Solace CLI, SEMP, or SolAdmin.
- In a connected Session, a client can remove a durable endpoint that was provisioned through the API, as follows: Call a method or function listed in the table below and pass in the endpoint to remove, the object for the JCSMP API, and the provision flags to indicate whether the “deprovisioning” should be done synchronously or asynchronously. For more information, see thesee the PubSub+ Messaging API for JCSMP reference.
A client can only remove an endpoint if it originally provisioned the endpoint (that is, if it is the owner of the endpoint) or if the endpoint is provisioned with Delete permission level, which allows other clients to remove the endpoint (refer to Defining Endpoint Properties in the PubSub+ JCSMP API).
Endpoints created via a management interface (Broker Manager, SolAdmin, CLI or SEMP) can be deprovisioned and deleted only by management. That is, if the endpoint was created by management, it cannot be deprovisioned by a client using an API, regardless of the configured permission.
To dynamically deprovision durable endpoints, use the JCSMPSession.deprovision(...)
method. For more information, see the PubSub+ Messaging API for JCSMP reference.