Type alias MessageRouter

MessageRouter: ((message: Message, topicMetadata: TopicMetadata) => number)

Type declaration

    • (message: Message, topicMetadata: TopicMetadata): number
    • Description

      When producing messages to a partitioned topic, this router is used to select the target partition for each message. The router only works when the messageRoutingMode is set to CustomPartition. Please note that getTopicName() cannot be called on the message, otherwise the behavior will be undefined because the topic is unknown before sending the message.

      Returns

      The index of the target partition (must be a number between 0 and topicMetadata.numPartitions - 1).

      Parameters

      • message: Message

        The message to be routed.

      • topicMetadata: TopicMetadata

        Metadata for the partitioned topic the message is being routed to.

      Returns number

Generated using TypeDoc