Skip to main content
Version: latest-snapshot

Configure topics

Hazelcast provides a distribution mechanism for publishing messages that are delivered to multiple subscribers. This is known as a publish/subscribe (pub/sub) messaging model. Publishing and subscription operations are cluster wide. When a member subscribes to a topic, it is registered to receive messages published by any member in the cluster, including any new members that joined after you added the listener. You can create and configure topics using the Topic custom resource.

Configure a topic resource​

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

FieldDescription
nameName of the topic that you're creating. If empty, the custom resource (CR) name is used.
hazelcastResourceNameThe name of the Hazelcast resource.
globalOrderingEnabledWhen true, all nodes listening to the same topic get their messages in the same order.
multiThreadingEnabled

When true, enables multi-threaded processing of incoming messages. Otherwise, a single thread handles all topic messages.

note

You cannot enable multi-threading when global ordering is in use.

Example configuration​

The following Topic custom resource creates a topic configuration for the Hazelcast custom resource that is defined in the hazelcastResourceName field.

Example configuration
yaml
apiVersion: hazelcast.com/v1alpha1
kind: Topic
metadata:
name: topic-sample
spec:
hazelcastResourceName: hazelcast-sample
globalOrderingEnabled: true
multiThreadingEnabled: false

After creating the Topic resource, you can check its status:

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