@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, wait
findBeanRegistration
public 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)
CustomScope
get
in interface CustomScope<KafkaClient>
T
- The bean generic typeresolutionContext
- The bean resolution contextbeanDefinition
- The bean definitionidentifier
- The BeanIdentifier
provider
- The provider that will build the bean definition@Nonnull public <K,V> KafkaProducer getProducer(String id, Argument<K> keyType, Argument<V> valueType)
KafkaProducerRegistry
getProducer
in interface KafkaProducerRegistry
K
- The key generic typeV
- The value generic typeid
- The id of the producer.keyType
- The key typevalueType
- The value typepublic KafkaClientScope stop()
LifeCycle
stop
in interface LifeCycle<KafkaClientScope>
public <T> Optional<T> remove(BeanIdentifier identifier)
CustomScope
remove
in interface CustomScope<KafkaClient>
T
- The generic typeidentifier
- The BeanIdentifier
Optional
of the instance if it exists