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+ JavaScript API, PubSub+ Node.js API, PubSub+ Java RTO API, or PubSub+ .NET API, 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 PubSub+ 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:
- QueueProvision.java for the PubSub+ Java RTO API
- QueueSubscriber.c for the PubSub+ C API
- QueueConsumer.cs for the PubSub+ .NET API
Provisioning Durable Endpoints Using the PubSub+ Messaging API
To dynamically provision a durable endpoint using the PubSub+ Messaging API, complete the following steps:
-
Create a local API representation of an endpoint.
- For the PubSub+ Java RTO API, PubSub+ JavaScript API, PubSub+ Node.js API, and PubSub+ .NET API, this is a queue or endpoint object.
- For the PubSub+ 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 |
---|---|
PubSub+ Java RTO API |
// 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+ Java RTO API reference. |
PubSub+ C API |
// 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+ C API reference. |
PubSub+ .NET API |
// 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+ .NET API reference. |
PubSub+ JavaScript API and PubSub+ Node.js API |
// 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+ JavaScript API reference or the PubSub+ Node.js API reference. |
Using the Missing Resource Creation Strategy in the PubSub+ JavaScript API and PubSub+ Node.js API
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 PubSub+ JavaScript API
- QueueConsumer.js for the PubSub+ Node.js API
Deprovisioning Durable Endpoints Using the PubSub+ Messaging 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 (that is, the object for the PubSub+ Java RTO API, PubSub+ JavaScript API, PubSub+ Node.js API, and PubSub+ .NET API, or the endpoint name and type for the PubSub+ 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 PubSub+ 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 (see 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 |
---|---|
PubSub+ Java RTO API |
For more information, see the PubSub+ Java RTO API reference. |
PubSub+ C API |
For more information, see the PubSub+ C API reference. |
PubSub+ .NET API |
For more information, see the PubSub+ .NET API reference. |
PubSub+ JavaScript API and PubSub+ Node.js API |
For more information, see the PubSub+ JavaScript API reference or the PubSub+ Node.js API reference. |