Interface ReplyingKafkaOperations<K,V,R>
- Type Parameters:
K
- the key type.V
- the outbound data type.R
- the reply data type.
- All Known Implementing Classes:
AggregatingReplyingKafkaTemplate
,ReplyingKafkaTemplate
public interface ReplyingKafkaOperations<K,V,R>
Request/reply operations.
- Since:
- 2.1.3
- Author:
- Gary Russell
-
Method Summary
Modifier and TypeMethodDescriptionsendAndReceive
(org.apache.kafka.clients.producer.ProducerRecord<K, V> record) Send a request and receive a reply with the default timeout.sendAndReceive
(org.apache.kafka.clients.producer.ProducerRecord<K, V> record, Duration replyTimeout) Send a request and receive a reply.default RequestReplyMessageFuture<K,
V> sendAndReceive
(Message<?> message) Send a request message and receive a reply message with the default timeout.default RequestReplyMessageFuture<K,
V> sendAndReceive
(Message<?> message, Duration replyTimeout) Send a request message and receive a reply message.default <P> RequestReplyTypedMessageFuture<K,
V, P> sendAndReceive
(Message<?> message, Duration replyTimeout, ParameterizedTypeReference<P> returnType) Send a request message and receive a reply message.default <P> RequestReplyTypedMessageFuture<K,
V, P> sendAndReceive
(Message<?> message, ParameterizedTypeReference<P> returnType) Send a request message and receive a reply message.default boolean
waitForAssignment
(Duration duration) Wait until partitions are assigned, e.g.
-
Method Details
-
waitForAssignment
Wait until partitions are assigned, e.g. whenauto.offset.reset=latest
. When using manual assignment, the duration must be greater than the container'spollTimeout
property.- Parameters:
duration
- how long to wait.- Returns:
- true if the partitions have been assigned.
- Throws:
InterruptedException
- if the thread is interrupted while waiting.- Since:
- 2.8.8
-
sendAndReceive
Send a request message and receive a reply message with the default timeout.- Parameters:
message
- the message to send.- Returns:
- a RequestReplyMessageFuture.
- Since:
- 2.7
-
sendAndReceive
default RequestReplyMessageFuture<K,V> sendAndReceive(Message<?> message, @Nullable Duration replyTimeout) Send a request message and receive a reply message.- Parameters:
message
- the message to send.replyTimeout
- the reply timeout; if null, the default will be used.- Returns:
- a RequestReplyMessageFuture.
- Since:
- 2.7
-
sendAndReceive
default <P> RequestReplyTypedMessageFuture<K,V, sendAndReceiveP> (Message<?> message, ParameterizedTypeReference<P> returnType) Send a request message and receive a reply message.- Type Parameters:
P
- the reply payload type.- Parameters:
message
- the message to send.returnType
- a hint to the message converter for the reply payload type.- Returns:
- a RequestReplyMessageFuture.
- Since:
- 2.7
-
sendAndReceive
default <P> RequestReplyTypedMessageFuture<K,V, sendAndReceiveP> (Message<?> message, Duration replyTimeout, ParameterizedTypeReference<P> returnType) Send a request message and receive a reply message.- Type Parameters:
P
- the reply payload type.- Parameters:
message
- the message to send.replyTimeout
- the reply timeout; if null, the default will be used.returnType
- a hint to the message converter for the reply payload type.- Returns:
- a RequestReplyMessageFuture.
- Since:
- 2.7
-
sendAndReceive
RequestReplyFuture<K,V, sendAndReceiveR> (org.apache.kafka.clients.producer.ProducerRecord<K, V> record) Send a request and receive a reply with the default timeout.- Parameters:
record
- the record to send.- Returns:
- a RequestReplyFuture.
-
sendAndReceive
RequestReplyFuture<K,V, sendAndReceiveR> (org.apache.kafka.clients.producer.ProducerRecord<K, V> record, Duration replyTimeout) Send a request and receive a reply.- Parameters:
record
- the record to send.replyTimeout
- the reply timeout; if null, the default will be used.- Returns:
- a RequestReplyFuture.
- Since:
- 2.3
-