Class KafkaPublisher<K,​V>

  • Type Parameters:
    K - Key type
    V - Value type
    All Implemented Interfaces:
    org.reactivestreams.Publisher<KafkaMessage<K,​V>>

    public class KafkaPublisher<K,​V>
    extends Object
    implements org.reactivestreams.Publisher<KafkaMessage<K,​V>>
    This is an implementation of Publisher that read messages from Kafka and push them downstream to one subscriber. Configurable by Helidon Config,
    See Also:
    Config
    • Method Detail

      • stop

        public void stop()
        Closes the opened resources to Kafka and completes exceptionally the pending Message.ack(). It must be invoked after ScheduledExecutorService is shutdown.
      • runInNewContext

        protected void runInNewContext​(Runnable runnable)
      • subscribe

        public void subscribe​(org.reactivestreams.Subscriber<? super KafkaMessage<K,​V>> subscriber)
        Specified by:
        subscribe in interface org.reactivestreams.Publisher<K>
      • builder

        public static <K,​V> KafkaPublisher.Builder<K,​V> builder()
        A builder for KafkaPublisher.
        Type Parameters:
        K - Key type
        V - Value type
        Returns:
        builder to create a new instance
      • create

        public static <K,​V> KafkaPublisher<K,​V> create​(Config config)
        Load this builder from a configuration.
        Type Parameters:
        K - Key type
        V - Value type
        Parameters:
        config - configuration to load from
        Returns:
        updated builder instance