IN- The message type which should write to Pulsar.
@Internal public class RoundRobinTopicRouter<IN> extends Object implements TopicRouter<IN>
TopicRoutingMode.ROUND_ROBINpolicy, we would use this implementation. We would pick the topic one by one in a fixed batch size.
|Constructor and Description|
|Modifier and Type||Method and Description|
Choose the topic by given record & available partition list.
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public RoundRobinTopicRouter(SinkConfiguration configuration)
in- The record instance which need to be written to Pulsar.
key- The key of the message from
PulsarMessageBuilder.key(String). It could be null, if message doesn't have a key.
partitions- The available partition list. This could be empty if you don't provide any topics in
PulsarSinkBuilder.setTopics(String...). You can return a custom topic, but make sure it should contain a partition index in naming. Using
TopicNameUtils.topicNameWithPartition(String, int)can easily create a topic name with partition index.
context- The context contains useful information for determining the topic.
Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.