Class KafkaUtils
- java.lang.Object
- 
- org.springframework.kafka.support.KafkaUtils
 
- 
 public final class KafkaUtils extends java.lang.ObjectUtility methods.- Since:
- 2.2
- Author:
- Gary Russell
 
- 
- 
Field SummaryFields Modifier and Type Field Description static booleanMICROMETER_PRESENTTrue if micrometer is on the class path.
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclearConsumerGroupId()Clear the group id for the consumer bound to this thread.static java.time.DurationdetermineSendTimeout(java.util.Map<java.lang.String,java.lang.Object> producerProps, long buffer, long min)Return the timeout to use when sending records.static java.lang.StringgetConsumerGroupId()Get the group id for the consumer bound to this thread.static booleanreturnTypeMessageOrCollectionOf(java.lang.reflect.Method method)Return true if the method return type isMessageorCollection<Message<?>>.static voidsetConsumerGroupId(java.lang.String groupId)Set the group id for the consumer bound to this thread.
 
- 
- 
- 
Method Detail- 
returnTypeMessageOrCollectionOfpublic static boolean returnTypeMessageOrCollectionOf(java.lang.reflect.Method method) Return true if the method return type isMessageorCollection<Message<?>>.- Parameters:
- method- the method.
- Returns:
- true if it returns message(s).
 
 - 
setConsumerGroupIdpublic static void setConsumerGroupId(java.lang.String groupId) Set the group id for the consumer bound to this thread.- Parameters:
- groupId- the group id.
- Since:
- 2.3
 
 - 
getConsumerGroupIdpublic static java.lang.String getConsumerGroupId() Get the group id for the consumer bound to this thread.- Returns:
- the group id.
- Since:
- 2.3
 
 - 
clearConsumerGroupIdpublic static void clearConsumerGroupId() Clear the group id for the consumer bound to this thread.- Since:
- 2.3
 
 - 
determineSendTimeoutpublic static java.time.Duration determineSendTimeout(java.util.Map<java.lang.String,java.lang.Object> producerProps, long buffer, long min)Return the timeout to use when sending records. If theProducerConfig.DELIVERY_TIMEOUT_MS_CONFIGis not configured, or is not a number or a String that can be parsed as a long, theProducerConfigdefault value (plus the buffer) is used.- Parameters:
- producerProps- the producer properties.
- buffer- a buffer to add to the configured- ProducerConfig.DELIVERY_TIMEOUT_MS_CONFIGto prevent timing out before the Kafka producer.
- min- a minimum value to apply after adding the buffer to the configured timeout.
- Returns:
- the timeout to use.
- Since:
- 2.7
 
 
- 
 
-