What is the difference between all the different Queues?
As I was trying out Solace PubSub+ with java implementation I tried to use Persistent messages as our previous eventing system used a similar concept.
As I was exploring the concept of Queues showed up and I noticed there were many different kinds. The first part of this question is what is the difference between Queue.durableExclusiveQueue(queueName) , Queue.durableNonExclusiveQueue(queueName) and Queue.nonDurableExclusiveQueue()
Additionally, I noticed that you needed in many cases with the durableExclusiveQueue and durableNonExclusiveQueue that a queue needed to exist first before you can reference it. Which made me wonder if it was possible to create it dynamically using an api in Java. I found this https://solace.com/blog/create-message-queue-in-solace/ post which shows you can do it with JCSMP. I was wondering if its also possible with just the java implementation.
In general is there any recommendations with how queues should be used? (1 per app. 1 per use case) Any recommendation with how many queue should be maintained at same time? Or any general pointers around queues would be nice.
Best Answer
-
Hey @mabourahal2 - great question! On a high level:
Durability
- Durable queue: Created on the Solace broker and stays there until it is explicitly deleted. A durable queue can have one or many consumers that binds to it. Note that the name of the queue is administrator or application defined
- Non durable Queue: Also known as temporary queue, has a shorter lifecycle and can only be created by an application. This type of queue has a lifespan of the client that created it, with an additional 60 seconds in case of unexpected disconnect. A non durable queue have one consumer that binds to it. Note that the name of the queue is application defined or automatically generated
Here is a blog you can check out Understanding Solace Endpoints: Durable vs. Non-Durable
Exclusivity
This refers to the number of clients that can bind to the queue:
- Exclusive Queue: Allows only one flow to the client. If there are other clients bound to the queue, they will be on standby mode. Think of active/standby modes; there is only one active client bound to the queue but multiple standby clients.
- Non Exclusive queue: multiple clients can bind to the queue and the messages are routed in a round robin fashion.
Here is a blog you can check out Understanding Solace Endpoints: Message Queue Access Types for Consumers
For further learnings, I would recommend checking out this playlist
https://www.youtube.com/playlist?list=PLY1Ks8JEfJR57vCkrQK0Y9bn8DKNMMJI_
What queue to use?
It depends on your use-case. For example:
- Do you care about message ordering and maintaining FIFO? Use exclusive queue
- Do you care about not loosing messages when the client is down? Use durable queue
- Do you want to load balance the processing of messages between multiple clients? Use non-exclusive
- Do you want queues to be only created by the consuming application? use non-durable queues
How can I create it?
You have multiple ways to do so. Since the creation of queues falls under a management/administrator task, you can create a durable queue and set the exclusivity type using one of the three ways
- SEMP: Solace Management API (Solace Element Management Protocol)
- CLI
- UI
Note: you can also create Durable queues directly from the Solace's Messaging API. So for example, with the Solace Pubsub+ Messaging API for Java, you can use the Missing Resource Strategy from the API.
Note: If your application requires Durable queues, it is recommended to create the queue outside the messaging application (either using the SEMP management API or have it created by an admin on the broker) and just have your messaging application bind to the already existing durable queue. However if you want to use a non-durable queue, you can create it directly from your messaging application upon creating a persistent message receiver with a non-durable queue binding.
Solace best practice
Always publish on topics from the publisher. If you want to queue your messages, add topic subscriptions to your queues and they will attract the message (i.e. promote the message from Direct messaging mode to Persistent messaging mode). Here is a good blog about message promotion Understanding Solace Delivery Modes: Promotion & Demotion
0
Answers
-
Hey @mabourahal2 - great question! On a high level:
Durability
- Durable queue: Created on the Solace broker and stays there until it is explicitly deleted. A durable queue can have one or many consumers that binds to it. Note that the name of the queue is administrator or application defined
- Non durable Queue: Also known as temporary queue, has a shorter lifecycle and can only be created by an application. This type of queue has a lifespan of the client that created it, with an additional 60 seconds in case of unexpected disconnect. A non durable queue have one consumer that binds to it. Note that the name of the queue is application defined or automatically generated
Here is a blog you can check out Understanding Solace Endpoints: Durable vs. Non-Durable
Exclusivity
This refers to the number of clients that can bind to the queue:
- Exclusive Queue: Allows only one flow to the client. If there are other clients bound to the queue, they will be on standby mode. Think of active/standby modes; there is only one active client bound to the queue but multiple standby clients.
- Non Exclusive queue: multiple clients can bind to the queue and the messages are routed in a round robin fashion.
Here is a blog you can check out Understanding Solace Endpoints: Message Queue Access Types for Consumers
For further learnings, I would recommend checking out this playlist
https://www.youtube.com/playlist?list=PLY1Ks8JEfJR57vCkrQK0Y9bn8DKNMMJI_
What queue to use?
It depends on your use-case. For example:
- Do you care about message ordering and maintaining FIFO? Use exclusive queue
- Do you care about not loosing messages when the client is down? Use durable queue
- Do you want to load balance the processing of messages between multiple clients? Use non-exclusive
- Do you want queues to be only created by the consuming application? use non-durable queues
How can I create it?
You have multiple ways to do so. Since the creation of queues falls under a management/administrator task, you can create a durable queue and set the exclusivity type using one of the three ways
- SEMP: Solace Management API (Solace Element Management Protocol)
- CLI
- UI
Note: you can also create Durable queues directly from the Solace's Messaging API. So for example, with the Solace Pubsub+ Messaging API for Java, you can use the Missing Resource Strategy from the API.
Note: If your application requires Durable queues, it is recommended to create the queue outside the messaging application (either using the SEMP management API or have it created by an admin on the broker) and just have your messaging application bind to the already existing durable queue. However if you want to use a non-durable queue, you can create it directly from your messaging application upon creating a persistent message receiver with a non-durable queue binding.
Solace best practice
Always publish on topics from the publisher. If you want to queue your messages, add topic subscriptions to your queues and they will attract the message (i.e. promote the message from Direct messaging mode to Persistent messaging mode). Here is a good blog about message promotion Understanding Solace Delivery Modes: Promotion & Demotion
0