IN - The message type which should write to Pulsar.@Internal public class RoundRobinTopicRouter<IN> extends Object implements TopicRouter<IN>
TopicRoutingMode.ROUND_ROBIN policy, we would use this implementation.
We would pick the topic one by one in a fixed batch size.| Constructor and Description |
|---|
RoundRobinTopicRouter(SinkConfiguration configuration) |
| Modifier and Type | Method and Description |
|---|---|
String |
route(IN in,
String key,
List<String> partitions,
PulsarSinkContext context)
Choose the topic by given record & available partition list.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitopenpublic RoundRobinTopicRouter(SinkConfiguration configuration)
public String route(IN in, String key, List<String> partitions, PulsarSinkContext context)
TopicRouterroute in interface TopicRouter<IN>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.