Class KafkaConnector
- java.lang.Object
-
- io.smallrye.reactive.messaging.kafka.KafkaConnector
-
- All Implemented Interfaces:
HealthReporter
,ConnectorFactory
,IncomingConnectorFactory
,OutgoingConnectorFactory
@ApplicationScoped public class KafkaConnector extends Object implements IncomingConnectorFactory, OutgoingConnectorFactory, HealthReporter
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONNECTOR_NAME
static io.opentelemetry.api.trace.Tracer
TRACER
-
Fields inherited from interface org.eclipse.microprofile.reactive.messaging.spi.ConnectorFactory
CHANNEL_NAME_ATTRIBUTE, CONNECTOR_ATTRIBUTE, CONNECTOR_PREFIX, INCOMING_PREFIX, OUTGOING_PREFIX
-
-
Constructor Summary
Constructors Constructor Description KafkaConnector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <K,V>
KafkaConsumer<K,V>getConsumer(String channel)
Set<String>
getConsumerChannels()
HealthReport
getLiveness()
<K,V>
KafkaProducer<K,V>getProducer(String channel)
Set<String>
getProducerChannels()
org.eclipse.microprofile.reactive.streams.operators.PublisherBuilder<? extends Message<?>>
getPublisherBuilder(org.eclipse.microprofile.config.Config config)
Creates a channel for the given configuration.HealthReport
getReadiness()
HealthReport
getStartup()
org.eclipse.microprofile.reactive.streams.operators.SubscriberBuilder<? extends Message<?>,Void>
getSubscriberBuilder(org.eclipse.microprofile.config.Config config)
Creates a channel for the given configuration.void
terminate(Object event)
-
-
-
Field Detail
-
CONNECTOR_NAME
public static final String CONNECTOR_NAME
- See Also:
- Constant Field Values
-
TRACER
public static io.opentelemetry.api.trace.Tracer TRACER
-
-
Method Detail
-
terminate
public void terminate(@Observes(notifyObserver=IF_EXISTS) @Priority(50) @BeforeDestroyed(javax.enterprise.context.ApplicationScoped.class) Object event)
-
getPublisherBuilder
public org.eclipse.microprofile.reactive.streams.operators.PublisherBuilder<? extends Message<?>> getPublisherBuilder(org.eclipse.microprofile.config.Config config)
Description copied from interface:IncomingConnectorFactory
Creates a channel for the given configuration. The channel's configuration is associated with a specificconnector
, using theConnector
qualifier's parameter indicating a key to whichIncomingConnectorFactory
to use.Note that the connection to the transport or broker is generally postponed until the subscription occurs.
- Specified by:
getPublisherBuilder
in interfaceIncomingConnectorFactory
- Parameters:
config
- the configuration, must not benull
, must contain theConnectorFactory.CHANNEL_NAME_ATTRIBUTE
attribute.- Returns:
- the created
PublisherBuilder
, will not benull
.
-
getSubscriberBuilder
public org.eclipse.microprofile.reactive.streams.operators.SubscriberBuilder<? extends Message<?>,Void> getSubscriberBuilder(org.eclipse.microprofile.config.Config config)
Description copied from interface:OutgoingConnectorFactory
Creates a channel for the given configuration. The channel's configuration is associated with a specificconnector
, using theConnector
qualifier's parameter indicating a key to whichOutgoing
to use.Note that the connection to the transport or broker is generally postponed until the subscription.
- Specified by:
getSubscriberBuilder
in interfaceOutgoingConnectorFactory
- Parameters:
config
- the configuration, nevernull
, must contain theConnectorFactory.CHANNEL_NAME_ATTRIBUTE
attribute.- Returns:
- the created
SubscriberBuilder
, must not benull
.
-
getStartup
public HealthReport getStartup()
- Specified by:
getStartup
in interfaceHealthReporter
-
getReadiness
public HealthReport getReadiness()
- Specified by:
getReadiness
in interfaceHealthReporter
-
getLiveness
public HealthReport getLiveness()
- Specified by:
getLiveness
in interfaceHealthReporter
-
getConsumer
public <K,V> KafkaConsumer<K,V> getConsumer(String channel)
-
getProducer
public <K,V> KafkaProducer<K,V> getProducer(String channel)
-
-