File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -181,6 +181,17 @@ export interface TopicMetadata {
181181 numPartitions : number ;
182182}
183183
184+ /**
185+ * @callback MessageRouter
186+ * @description When producing messages to a partitioned topic, this router is used to select the
187+ * target partition for each message. The router only works when the `messageRoutingMode` is set to
188+ * `CustomPartition`. Please note that `getTopicName()` cannot be called on the `message`, otherwise
189+ * the behavior will be undefined because the topic is unknown before sending the message.
190+ * @param message The message to be routed.
191+ * @param topicMetadata Metadata for the partitioned topic the message is being routed to.
192+ * @returns {number } The index of the target partition (must be a number between 0 and
193+ * topicMetadata.numPartitions - 1).
194+ */
184195export type MessageRouter = ( message : Message , topicMetadata : TopicMetadata ) => number ;
185196
186197export interface SchemaInfo {
You can’t perform that action at this time.
0 commit comments