Options
All
  • Public
  • Public/Protected
  • All
Menu

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.

Type parameters

  • E

Hierarchy

Index

Methods

addMessageListener

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

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

    Parameters

    Returns string

    registration ID

destroy

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

    Returns Promise<void>

getName

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

    Returns string

getPartitionKey

  • 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

  • getServiceName(): string

publish

  • publish(message: E): Promise<void>
  • 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>

removeMessageListener

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

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

    Parameters

    • listenerId: string

      listener registration ID

    Returns boolean

    true if registration is removed, false otherwise

Generated using TypeDoc