Configuring 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.
Configuring a Topic Resource
You can use any of the following configuration options in the Topic
resource. For more information, see the API Reference.
Field | Description | ||
---|---|---|---|
|
Name of the topic configuration that you’re creating. If empty, the custom resource (CR) name is used. |
||
|
Defines the name of the Hazelcast resource for which the topic configuration is created. |
||
|
When true, all nodes listening to the same topic get their messages in the same order. |
||
|
When true, enables multi-threaded processing of incoming messages. Otherwise, a single thread handles all topic messages.
|
Example Configuration
The following Topic
custom resource creates a topic configuration for the Hazelcast
custom resource that is defined in the hazelcastResourceName
field.
apiVersion: hazelcast.com/v1alpha1
kind: Topic
metadata:
name: topic-sample
spec:
hazelcastResourceName: hazelcast-sample
globalOrderingEnabled: true
multiThreadingEnabled: false
After creating the Topic
resource, use the following command to check its status:
kubectl get topic topic-sample -o wide
NAME STATUS HAZELCAST-RESOURCE MESSAGE
topic-sample Success hazelcast-sample