@Singleton public class KafkaClientScope extends java.lang.Object implements io.micronaut.context.scope.CustomScope<KafkaClient>, io.micronaut.context.LifeCycle<KafkaClientScope>, ProducerRegistry
Producer
instances.Constructor and Description |
---|
KafkaClientScope(io.micronaut.context.BeanContext beanContext,
SerdeRegistry serdeRegistry)
Constructs a new client scope.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Class<KafkaClient> |
annotationType() |
<T> T |
get(io.micronaut.context.BeanResolutionContext resolutionContext,
io.micronaut.inject.BeanDefinition<T> beanDefinition,
io.micronaut.inject.BeanIdentifier identifier,
javax.inject.Provider<T> provider) |
<K,V> org.apache.kafka.clients.producer.Producer<K,V> |
getProducer(java.lang.String id,
io.micronaut.core.type.Argument<K> keyType,
io.micronaut.core.type.Argument<V> valueType)
Returns a managed Producer.
|
boolean |
isRunning() |
<T> java.util.Optional<T> |
remove(io.micronaut.inject.BeanIdentifier identifier) |
KafkaClientScope |
stop() |
public KafkaClientScope(io.micronaut.context.BeanContext beanContext, SerdeRegistry serdeRegistry)
beanContext
- The bean contextserdeRegistry
- The serde registrypublic boolean isRunning()
isRunning
in interface io.micronaut.context.LifeCycle<KafkaClientScope>
public java.lang.Class<KafkaClient> annotationType()
annotationType
in interface io.micronaut.context.scope.CustomScope<KafkaClient>
public <T> T get(io.micronaut.context.BeanResolutionContext resolutionContext, io.micronaut.inject.BeanDefinition<T> beanDefinition, io.micronaut.inject.BeanIdentifier identifier, javax.inject.Provider<T> provider)
get
in interface io.micronaut.context.scope.CustomScope<KafkaClient>
@Nonnull public <K,V> org.apache.kafka.clients.producer.Producer<K,V> getProducer(java.lang.String id, io.micronaut.core.type.Argument<K> keyType, io.micronaut.core.type.Argument<V> valueType)
ProducerRegistry
getProducer
in interface ProducerRegistry
K
- The key generic typeV
- The value generic typeid
- The id of the producer.keyType
- The key typevalueType
- The value typepublic KafkaClientScope stop()
stop
in interface io.micronaut.context.LifeCycle<KafkaClientScope>
public <T> java.util.Optional<T> remove(io.micronaut.inject.BeanIdentifier identifier)
remove
in interface io.micronaut.context.scope.CustomScope<KafkaClient>