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).
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
messageRoutingModeis set toCustomPartition. Please note thatgetTopicName()cannot be called on themessage, 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).