Configuring Queues
Hazelcast distributed queue is an implementation of java.util.concurrent.BlockingQueue. Being distributed, Hazelcast distributed queue enables all cluster members to interact with it. Using Hazelcast distributed queue, you can add an item in one cluster member and remove it from another one. You can create and configure queue using the Queue
custom resource.
Configuring a Queue Resource
You can use any of the following configuration options in the Queue
resource. For more information, see the API Reference.
Field | Description |
---|---|
|
Name of the queue configuration that you’re creating. If empty, the custom resource (CR) name is used. |
|
Defines the name of the Hazelcast resource for which the queue configuration is created. |
|
Count of synchronous backups. |
|
Count of asynchronous backups. |
|
Max size of the queue. |
|
Time in seconds after which the Queue will be destroyed if it stays empty or unused. If the values is not provided the Queue will never be destroyed. |
|
The name of the comparator class. If the class name is provided, the Queue becomes Priority Queue. |
Example Configuration
The following Queue
custom resource creates a queue configuration for the Hazelcast
custom resource that is defined in the hazelcastResourceName
field.
apiVersion: hazelcast.com/v1alpha1
kind: Queue
metadata:
name: queue-sample
spec:
hazelcastResourceName: hazelcast
backupCount: 1
asyncBackupCount: 0
emptyQueueTTLSeconds: -1
maxSize: 0
priorityComparatorClassName: "com.hazelcast.collection.impl.queue.model.PriorityElementComparator"
After creating the Queue
resource, use the following command to check its status:
kubectl get queue queue-sample -o wide
NAME STATUS MESSAGE
queue-sample Success