• Public
  • Public/Protected
  • All

Hazelcast provides distribution mechanism for publishing messages that are delivered to multiple subscribers, which is also known as a publish/subscribe (pub/sub) messaging model. Publish and subscriptions are cluster-wide.

This interface stand for reliable topic, i.e. it uses a Ringbuffer to store events. The events in the Ringbuffer are replicated, so they won't get lost when a node goes down.

Methods that require serialization/deserialization may throw RangeError, e.g when there is no suitable serializer for a certain type. Also they may throw HazelcastSerializationError if a compact object is cannot be deserialized due to unknown schema.

Type Parameters

  • E




  • Subscribes to this topic. When a message is published, the given MessageListener is called.

    More than one message listener can be added on one instance.


    Returns string

    registration ID

  • destroy(): Promise<void>
  • Destroys this object cluster-wide. Clears all resources taken for this object.

    Returns Promise<void>

  • getName(): string
  • Returns the unique name of this object.

    Returns string

  • getPartitionKey(): string
  • Returns the key of the partition that this DistributedObject is assigned to. For a partitioned data structure, the returned value will not be null, but otherwise undefined.

    Returns string

  • getServiceName(): string
  • publish(message: E): Promise<void>
  • Publishes the message to all subscribers of this topic.


    • message: E

      the message to publish to all subscribers of this topic

    Returns Promise<void>

  • removeMessageListener(listenerId: string): boolean
  • Stops receiving messages for the given message listener.

    If the given listener already removed, this method does nothing.


    • listenerId: string

      listener registration ID

    Returns boolean

    true if registration is removed, false otherwise

Generated using TypeDoc