Class KafkaPublisher<K,V>
- java.lang.Object
-
- io.helidon.messaging.connectors.kafka.KafkaPublisher<K,V>
-
- Type Parameters:
K
- Key typeV
- Value type
- All Implemented Interfaces:
Publisher<KafkaMessage<K,V>>
public class KafkaPublisher<K,V> extends Object implements Publisher<KafkaMessage<K,V>>
This is an implementation ofPublisher
that read messages from Kafka and push them downstream to one subscriber. Configurable by HelidonConfig
,- See Also:
Config
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
KafkaPublisher.Builder<K,V>
Fluent API builder forKafkaPublisher
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <K,V>
KafkaPublisher.Builder<K,V>builder()
A builder for KafkaPublisher.static <K,V>
KafkaPublisher<K,V>create(Config config)
Load this builder from a configuration.protected void
runInNewContext(Runnable runnable)
void
stop()
Closes the opened resources to Kafka and completes exceptionally the pendingMessage.ack()
.void
subscribe(Subscriber<? super KafkaMessage<K,V>> subscriber)
-
-
-
Method Detail
-
stop
public void stop()
Closes the opened resources to Kafka and completes exceptionally the pendingMessage.ack()
. It must be invoked afterScheduledExecutorService
is shutdown.
-
runInNewContext
protected void runInNewContext(Runnable runnable)
-
subscribe
public void subscribe(Subscriber<? super KafkaMessage<K,V>> subscriber)
-
builder
public static <K,V> KafkaPublisher.Builder<K,V> builder()
A builder for KafkaPublisher.- Type Parameters:
K
- Key typeV
- 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 typeV
- Value type- Parameters:
config
- configuration to load from- Returns:
- updated builder instance
-
-