Yuval Simhon
Yuval Simhon

Reputation: 1459

Kafka Sticky Partitioner using spring cloud stream

I'm using spring cloud stream for Kafka consumer/producer.

We have multiple producers which defined with:

producer:
  partitionKeyExpression: payload.partitionKey

As well we do have producers without such definition, which seems it's using the default partitioner.

Is the sticky partitioner will take place in cases that payload.paritionKey is null?
Is the default partitioner, when no patitionKeyExpression / header are defined will set paritionKey as null and the sticky paritioner will take place?

Upvotes: 3

Views: 375

Answers (1)

Gary Russell
Gary Russell

Reputation: 174484

If there is no partitionKeyExpression, the partition will be determined by the KafkaProducer.

Look at the INFO log for the producer config. The default partitioner is

partitioner.class = class org.apache.kafka.clients.producer.internals.DefaultPartitioner

You can configure whatever partitioner you want via the binder or binding properties.

Upvotes: 1

Related Questions