Interface ITopic<E>

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

Hierarchy

Methods

  • 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

    registration ID

    Parameters

    Returns string

  • Publishes the message to all subscribers of this topic.

    Parameters

    • message: E

      the message to publish to all subscribers of this topic

    Returns Promise<void>

  • Stops receiving messages for the given message listener.

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

    Returns

    true if registration is removed, false otherwise

    Parameters

    • listenerId: string

      listener registration ID

    Returns boolean

Generated using TypeDoc