@Singleton public class KafkaClientScope extends Object implements CustomScope<KafkaClient>, LifeCycle<KafkaClientScope>, KafkaProducerRegistry
KafkaProducer instances.| Constructor and Description |
|---|
KafkaClientScope(BeanContext beanContext,
SerdeRegistry serdeRegistry)
Constructs a new client scope.
|
| Modifier and Type | Method and Description |
|---|---|
Class<KafkaClient> |
annotationType() |
<T> T |
get(BeanResolutionContext resolutionContext,
BeanDefinition<T> beanDefinition,
BeanIdentifier identifier,
Provider<T> provider)
Resolve an object from the given scope.
|
<K,V> KafkaProducer |
getProducer(String id,
Argument<K> keyType,
Argument<V> valueType)
Returns a managed Producer.
|
boolean |
isRunning() |
<T> Optional<T> |
remove(BeanIdentifier identifier)
Remove a bean definition from the scope.
|
KafkaClientScope |
stop()
Stops the life cycle component.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfindBeanRegistrationpublic KafkaClientScope(BeanContext beanContext, SerdeRegistry serdeRegistry)
beanContext - The bean contextserdeRegistry - The serde registrypublic boolean isRunning()
isRunning in interface LifeCycle<KafkaClientScope>public Class<KafkaClient> annotationType()
annotationType in interface CustomScope<KafkaClient>public <T> T get(BeanResolutionContext resolutionContext, BeanDefinition<T> beanDefinition, BeanIdentifier identifier, Provider<T> provider)
CustomScopeget in interface CustomScope<KafkaClient>T - The bean generic typeresolutionContext - The bean resolution contextbeanDefinition - The bean definitionidentifier - The BeanIdentifierprovider - The provider that will build the bean definition@Nonnull public <K,V> KafkaProducer getProducer(String id, Argument<K> keyType, Argument<V> valueType)
KafkaProducerRegistrygetProducer in interface KafkaProducerRegistryK - The key generic typeV - The value generic typeid - The id of the producer.keyType - The key typevalueType - The value typepublic KafkaClientScope stop()
LifeCyclestop in interface LifeCycle<KafkaClientScope>public <T> Optional<T> remove(BeanIdentifier identifier)
CustomScoperemove in interface CustomScope<KafkaClient>T - The generic typeidentifier - The BeanIdentifierOptional of the instance if it exists