Skip to main content
Version: 5.17

Configure queues

Hazelcast's distributed queue is an implementation of java.util.concurrent.BlockingQueue. Being distributed 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 queues using the Queue custom resource.

Configure a queue resource​

You can use any of the following configuration options in the Queue resource. For more information, see the API reference.

FieldDescription
nameName of the queue that you're creating. If empty, the custom resource (CR) name is used.
hazelcastResourceNameThe name of the Hazelcast resource.
backupCountCount of synchronous backups.
asyncBackupCountCount of asynchronous backups.
maxSizeMaximum size of the queue.
emptyQueueTTLSecondsTime in seconds after which the queue will be destroyed if it stays empty or unused. If this field is not set, the queue will never be destroyed.
priorityComparatorClassNameThe name of the comparator class. If the class name is provided, the queue becomes a 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.

Example configuration
yaml
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, you can check its status:

shell
kubectl get queue queue-sample -o wide
NAME STATUS HAZELCAST-RESOURCE MESSAGE
queue-sample Success hazelcast