Provisioning and Deprovisioning Durable Endpoints
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+ Messaging API for JCSMP, JavaScript, Node.js, Java RTO, or .NET, which are object-oriented, require 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 messaging API. To dynamically provision a durable endpoint, call a method or function listed in the table below and pass in endpoint properties and provision flags. For more information, see Defining Endpoint Properties.
Clients can provision durable endpoints through the API without immediately creating consuming flows to them.
Related Samples
For an example of how to dynamically provision durable endpoints, see:
- QueueProvisionAndBrowse.java for the JCSMP API
- QueueProvision.java for the Java RTO API
- QueueSubscriber.c for the C API
- QueueConsumer.cs for the .NET API
Provisioning Durable Endpoints Using the PubSub+ Messaging APIs
To dynamically provision a durable endpoint using the PubSub+ Messaging APIs, complete the following steps:
-
Create a local API representation of an endpoint.
- For the Java RTO, JavaScript, Node.js, JCSMP, and .NET APIs, this is a queue or endpoint object.
- For the C API, this is a list of queue or endpoint properties.
- Pass the object or property list to the appropriate method or function to provision the endpoint or queue on the event broker.
PubSub+ Messaging API | Use |
---|---|
JCSMP |
// 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. |
Java RTO |
// Create local queue or endpoint object: Solclient.Allocator.newQueue(...) Solclient.Allocator.newTopicEndpoint(...) // Provision the queue or endpoint on the event broker: SessionHandle.provision(...) For more information, see the PubSub+ Messaging API for Java RTO reference. |
C |
// Set local queue or endpoint properties in an array: provisionIndex = 0; provisionProps[provisionIndex++] = ...; // Provision the queue or endpoint on the event broker: solClient_session_endpointProvision(( char ** ) provisionProps, ...) For more information, see the PubSub+ Messaging API for C reference. |
.NET |
// Create local queue or endpoint object: ContextFactory.CreateQueue(...) ContextFactory.CreateDurableTopicEndpointEx(...) // Provision the queue or endpoint on the event broker: ISession.Provision(...) For more information, see the PubSub+ Messaging API for .NET reference. |
JavaScript and Node.js |
// Set local queue or endpoint properties in a QueueDescriptor object: new QueueDescriptor(...) // Provision the queue or endpoint on the event broker: session.provisionEndpoint(...) For more information, see the PubSub+ Messaging API for JavaScript reference or the PubSub+ Messaging API for Node.js reference. |
Using the Missing Resource Creation Strategy in the JavaScript and Node.js APIs
Another way to provision a queue or endpoint on the event broker is with the missing resource creation strategy. To use the missing resource creation strategy, set createIfMissing
to true
in the createMessageConsumer()
function:
subscriber.messageSubscriber = subscriber.session.createMessageConsumer({ // set solace.MessageConsumerProperties queueDescriptor: { name: subscriber.queueName, type: solace.QueueType.QUEUE }, createIfMissing: true });
When you set createIfMissing
to true
, the createMessageConsumer()
function creates the queue and signals the event broker to provision one with the same name if it does not already exist. The queue you provision on the event broker may be configured with queue templates or setting QueueProperties
directly when you create your MessageConsumer
object. When you use the missing resource creation strategy, queue templates will override only the provided queue attributes if the name of the queue you create matches the template name-filter
. For information about queue templates see Queues and Topic Endpoints, and for instructions on how to configure a queue template using the Solace CLI see Configuring Endpoint Templates. For an example of how to dynamically provision durable endpoints with the missing resource creation strategy, see:
- GuaranteedSubscriber.js for the JavaScript API
- QueueConsumer.js for the Node.js API
Deprovisioning Durable Endpoints Using the PubSub+ Messaging APIs
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 (that is, the object for the JCSMP, Java RTO, JavaScript, Node.js, and .NET APIs, or the endpoint name and type for the C API) and the provision flags to indicate whether the “deprovisioning” should be done synchronously or asynchronously. For more information, see the PubSub+ Messaging APIs documentation or the appropriate messaging API.
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).
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.
PubSub+ Messaging API | Use |
---|---|
JCSMP |
For more information, see the PubSub+ Messaging API for JCSMP reference. |
Java RTO |
For more information, see the PubSub+ Messaging API for Java RTO reference. |
C |
For more information, see the PubSub+ Messaging API for C reference. |
.NET |
For more information, see the PubSub+ Messaging API for .NET reference. |
JavaScript and Node.js |
For more information, see the PubSub+ Messaging API for JavaScript reference or the PubSub+ Messaging API for Node.js reference. |