K
- the key type.V
- the value type.public class Kafka09ProducerMessageHandlerSpec<K,V> extends MessageHandlerSpec<Kafka09ProducerMessageHandlerSpec<K,V>,Kafka09ProducerMessageHandler<K,V>>
MessageHandlerSpec
implementation for the KafkaProducerMessageHandler
.Modifier and Type | Class and Description |
---|---|
static class |
Kafka09ProducerMessageHandlerSpec.KafkaProducerMessageHandlerTemplateSpec<K,V>
A
KafkaTemplate -based Kafka09ProducerMessageHandlerSpec extension. |
Modifier and Type | Field and Description |
---|---|
protected org.springframework.kafka.core.KafkaTemplate<K,V> |
kafkaTemplate |
id, logger, PARSER, target
Modifier and Type | Method and Description |
---|---|
<P> Kafka09ProducerMessageHandlerSpec<K,V> |
messageKey(Function<org.springframework.messaging.Message<P>,?> messageKeyFunction)
Configure a
Function that will be invoked at run time to determine the message key under
which a message will be stored in the topic. |
Kafka09ProducerMessageHandlerSpec<K,V> |
messageKey(java.lang.String messageKey)
Configure the message key to store message in Kafka topic.
|
Kafka09ProducerMessageHandlerSpec<K,V> |
messageKeyExpression(org.springframework.expression.Expression messageKeyExpression)
Configure an
Expression to determine the Kafka message key to store at runtime against
request Message as a root object of evaluation context. |
Kafka09ProducerMessageHandlerSpec<K,V> |
messageKeyExpression(java.lang.String messageKeyExpression)
Configure a SpEL expression to determine the Kafka message key to store at runtime against
request Message as a root object of evaluation context.
|
<P> Kafka09ProducerMessageHandlerSpec<K,V> |
partitionId(Function<org.springframework.messaging.Message<P>,java.lang.Integer> partitionIdFunction)
Configure a
Function that will be invoked at run time to determine the partition id under
which a message will be stored in the topic. |
Kafka09ProducerMessageHandlerSpec<K,V> |
partitionId(java.lang.Integer partitionId)
Configure a partitionId of Kafka topic.
|
Kafka09ProducerMessageHandlerSpec<K,V> |
partitionIdExpression(org.springframework.expression.Expression partitionIdExpression)
Configure an
Expression to determine the topic partitionId at runtime against
request Message as a root object of evaluation context. |
Kafka09ProducerMessageHandlerSpec<K,V> |
partitionIdExpression(java.lang.String partitionIdExpression)
Configure a SpEL expression to determine the topic partitionId at runtime against
request Message as a root object of evaluation context.
|
<P> Kafka09ProducerMessageHandlerSpec<K,V> |
topic(Function<org.springframework.messaging.Message<P>,java.lang.String> topicFunction)
Configure a
Function that will be invoked at run time to determine the topic to
which a message will be sent. |
Kafka09ProducerMessageHandlerSpec<K,V> |
topic(java.lang.String topic)
Configure the Kafka topic to send messages.
|
Kafka09ProducerMessageHandlerSpec<K,V> |
topicExpression(org.springframework.expression.Expression topicExpression)
Configure an
Expression to determine the Kafka topic at runtime against
request Message as a root object of evaluation context. |
Kafka09ProducerMessageHandlerSpec<K,V> |
topicExpression(java.lang.String topicExpression)
Configure a SpEL expression to determine the Kafka topic at runtime against
request Message as a root object of evaluation context.
|
_this, doGet, get, getId, getObject, getObjectType, id, isSingleton
public Kafka09ProducerMessageHandlerSpec<K,V> topic(java.lang.String topic)
topic
- the Kafka topic name.public Kafka09ProducerMessageHandlerSpec<K,V> topicExpression(java.lang.String topicExpression)
topicExpression
- the topic SpEL expression.public Kafka09ProducerMessageHandlerSpec<K,V> topicExpression(org.springframework.expression.Expression topicExpression)
Expression
to determine the Kafka topic at runtime against
request Message as a root object of evaluation context.topicExpression
- the topic expression.public <P> Kafka09ProducerMessageHandlerSpec<K,V> topic(Function<org.springframework.messaging.Message<P>,java.lang.String> topicFunction)
Function
that will be invoked at run time to determine the topic to
which a message will be sent. Typically used with a Java 8 Lambda expression:
.<Foo>topic(m -> m.getPayload().getTopic())
P
- the expected payload type.topicFunction
- the topic function.Kafka09ProducerMessageHandlerSpec
.FunctionExpression
public Kafka09ProducerMessageHandlerSpec<K,V> messageKeyExpression(java.lang.String messageKeyExpression)
messageKeyExpression
- the message key SpEL expression.public Kafka09ProducerMessageHandlerSpec<K,V> messageKey(java.lang.String messageKey)
messageKey
- the message key to use.public Kafka09ProducerMessageHandlerSpec<K,V> messageKeyExpression(org.springframework.expression.Expression messageKeyExpression)
Expression
to determine the Kafka message key to store at runtime against
request Message as a root object of evaluation context.messageKeyExpression
- the message key expression.public <P> Kafka09ProducerMessageHandlerSpec<K,V> messageKey(Function<org.springframework.messaging.Message<P>,?> messageKeyFunction)
Function
that will be invoked at run time to determine the message key under
which a message will be stored in the topic. Typically used with a Java 8 Lambda expression:
.<Foo>messageKey(m -> m.getPayload().getKey())
P
- the expected payload type.messageKeyFunction
- the message key function.Kafka09ProducerMessageHandlerSpec
.FunctionExpression
public Kafka09ProducerMessageHandlerSpec<K,V> partitionId(java.lang.Integer partitionId)
partitionId
- the partitionId to use.public Kafka09ProducerMessageHandlerSpec<K,V> partitionIdExpression(java.lang.String partitionIdExpression)
partitionIdExpression
- the partitionId expression to use.public <P> Kafka09ProducerMessageHandlerSpec<K,V> partitionId(Function<org.springframework.messaging.Message<P>,java.lang.Integer> partitionIdFunction)
Function
that will be invoked at run time to determine the partition id under
which a message will be stored in the topic. Typically used with a Java 8 Lambda expression:
.partitionId(m -> m.getHeaders().get("partitionId", Integer.class))
P
- the expected payload type.partitionIdFunction
- the partitionId function.public Kafka09ProducerMessageHandlerSpec<K,V> partitionIdExpression(org.springframework.expression.Expression partitionIdExpression)
Expression
to determine the topic partitionId at runtime against
request Message as a root object of evaluation context.partitionIdExpression
- the partitionId expression to use.