Interface TopicResolver

All Known Implementing Classes:
DefaultTopicResolver

public interface TopicResolver
Resolves topics to use when producing or consuming.
Author:
Chris Bono
  • Method Details

    • resolveTopic

      Resolved<String> resolveTopic(@Nullable String userSpecifiedTopic, Supplier<String> defaultTopicSupplier)
      Resolve the topic name to use.
      Parameters:
      userSpecifiedTopic - the topic specified by the user
      defaultTopicSupplier - supplies the default topic to use (use a supplier that returns null to signal no default)
      Returns:
      the topic to use or empty if no topic could be resolved
    • resolveTopic

      <T> Resolved<String> resolveTopic(@Nullable String userSpecifiedTopic, @Nullable T message, Supplier<String> defaultTopicSupplier)
      Resolve the topic name to use for the given message.
      Type Parameters:
      T - the message type
      Parameters:
      userSpecifiedTopic - the topic specified by the user
      message - the message instance being produced or consumed
      defaultTopicSupplier - supplies the default topic to use (use a supplier that returns null to signal no default)
      Returns:
      the topic to use or empty if no topic could be resolved
    • resolveTopic

      Resolved<String> resolveTopic(@Nullable String userSpecifiedTopic, @Nullable Class<?> messageType, Supplier<String> defaultTopicSupplier)
      Resolve the topic name to use for the given message type.
      Parameters:
      userSpecifiedTopic - the topic specified by the user
      messageType - the message type being produced or consumed
      defaultTopicSupplier - supplies the default topic to use (use a supplier that returns null to signal no default)
      Returns:
      the topic to use or empty if no topic could be resolved