This is a prerelease version.

View latest

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.

Field Description

name

Name of the queue that you’re creating. If empty, the custom resource (CR) name is used.

hazelcastResourceName

The name of the Hazelcast resource.

backupCount

Count of synchronous backups.

asyncBackupCount

Count of asynchronous backups.

maxSize

Maximum size of the queue.

emptyQueueTTLSeconds

Time 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.

priorityComparatorClassName

The 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
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:

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