public final class ProducerWorkerManager
extends java.lang.Object
implements java.lang.AutoCloseable
ProducerWorker registry. Producers are registered with claimWorker(ClientConfig, GenericProducer, BaseProducerConfig) and a
ProducerWorker is retrieved from the registry. If the producer is not yet registered it will
create a new ProducerWorker and start the thread execution.
The ProducerWorker thread can be stopped with releaseWorker(GenericProducer)
This will cancel all messages still waiting in the message queue.
| Constructor and Description |
|---|
ProducerWorkerManager() |
| Modifier and Type | Method and Description |
|---|---|
<K,V> ProducerWorker<K,V> |
claimWorker(io.axual.common.config.ClientConfig clientConfig,
GenericProducer<K,V> producer,
BaseProducerConfig<K,V> producerConfig)
Checks if the producer exists in the registry.
|
void |
close()
Gracefully shutdown the ProducerWorkerManager.
|
<K,V> void |
releaseWorker(GenericProducer<K,V> producer)
Stops the running producer worker thread
|
public <K,V> ProducerWorker<K,V> claimWorker(io.axual.common.config.ClientConfig clientConfig, GenericProducer<K,V> producer, BaseProducerConfig<K,V> producerConfig)
ProducerWorker instance will be created, the thread started and the worker returned.K - the key type of produced messagesV - the value type of produced messagesproducer - The producer to be registeredclientConfig - The configuration of the client applicationproducerConfig - The configuration for the producerpublic <K,V> void releaseWorker(GenericProducer<K,V> producer)
K - the key type of the producerV - the value type of the producerproducer - the producerpublic void close()
close in interface java.lang.AutoCloseableCopyright © 2020–2021 Axual B.V.. All rights reserved.