3

I'm using the WriteKafaP vertex in a Jet job. Is there a way to plug in custom partition logic when publishing to the Kafka topic?

Marko Topolnik
  • 195,646
  • 29
  • 319
  • 436
Shannon Ma
  • 45
  • 4
  • You mean you want to determine the partition, to which the event will be published? – Oliv Nov 09 '17 at 15:13

1 Answers1

2

In 0.4, you can use a custom Kafka partitioner configuration. In 0.5, we added the ability to map the item to a ProducerRecord directly.

For example:

Vertex v = new Vertex("kafkaSink", KafkaProcessors.writeKafkaP(properties, o -> new ProducerRecord(topic, partition, key, value));

Can Gencer
  • 8,822
  • 5
  • 33
  • 52