Class AdapterUtils

java.lang.Object
org.springframework.kafka.listener.adapter.AdapterUtils

public final class AdapterUtils extends Object
Utilities for listener adapters.
Since:
2.5
Author:
Gary Russell, Wang Zhiyang, Huijin Hong
  • Field Details

    • PARSER_CONTEXT

      public static final ParserContext PARSER_CONTEXT
      Parser context for runtime SpEL using ! as the template prefix.
      Since:
      2.2.15
  • Method Details

    • buildConsumerRecordMetadataFromArray

      @Nullable public static Object buildConsumerRecordMetadataFromArray(Object... data)
      Build a ConsumerRecordMetadata from the first ConsumerRecord in data, if any.
      Parameters:
      data - the data array.
      Returns:
      the metadata or null if data does not contain a ConsumerRecord.
    • buildConsumerRecordMetadata

      @Nullable public static ConsumerRecordMetadata buildConsumerRecordMetadata(Object data)
      Build a ConsumerRecordMetadata from data which must be a ConsumerRecord.
      Parameters:
      data - the record.
      Returns:
      the metadata or null if data is not a ConsumerRecord.
    • getDefaultReplyTopicExpression

      public static String getDefaultReplyTopicExpression()
      Return the default expression when no SendTo value is present.
      Returns:
      the expression.
      Since:
      2.2.15
    • isAsyncReply

      public static boolean isAsyncReply(Class<?> resultType)
      Return the true when return types are asynchronous.
      Parameters:
      resultType - InvocableHandlerMethod return type.
      Returns:
      type is Mono or CompletableFuture.
      Since:
      3.2
    • isMono

      public static boolean isMono(Class<?> resultType)
      Return the true when type is Mono.
      Parameters:
      resultType - InvocableHandlerMethod return type.
      Returns:
      type is Mono.
      Since:
      3.2
    • isCompletableFuture

      public static boolean isCompletableFuture(Class<?> resultType)
      Return the true when type is CompletableFuture.
      Parameters:
      resultType - InvocableHandlerMethod return type.
      Returns:
      type is CompletableFuture.
      Since:
      3.2
    • isKotlinContinuation

      public static boolean isKotlinContinuation(Class<?> parameterType)
      Return the true when type is Continuation.
      Parameters:
      parameterType - MethodParameter parameter type.
      Returns:
      type is Continuation.
      Since:
      3.2.1