K - the type of the key that will be produced. A compatible key serializer must be
provided to serialize the objectsV - the type of the value that will be produced. A compatible value serializer must be
provided to serialize the objectsT - the type of the Builder that is to be used.public static class BaseProducerConfig.Builder<K,V,T extends BaseProducerConfig.Builder<K,V,T>>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected int |
batchSize |
protected java.lang.Boolean |
blocking |
protected DeliveryStrategy |
deliveryStrategy |
protected java.lang.Object |
keySerializer |
protected long |
lingerMs |
protected java.lang.Integer |
messageBufferSize |
protected int |
messageBufferWaitTimeout |
protected OrderingStrategy |
orderingStrategy |
protected ProxyChain |
proxyChain |
protected java.lang.Object |
valueSerializer |
| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
BaseProducerConfig<K,V> |
build()
Builds the
BaseProducerConfig object which is used by the AxualClient to
configure a producer |
T |
setBatchSize(int batchSize)
Sets the maximum size in bytes of the batch of messages to produce before sending.
|
T |
setBlocking(boolean blocking)
Indicate if the produce will block when the messageBuffer is full.
|
T |
setDeliveryStrategy(DeliveryStrategy deliveryStrategy)
Sets the delivery strategy to be used by the producer.
|
T |
setKeySerializer(org.apache.kafka.common.serialization.Serializer<K> keySerializer)
The configured class or instance implementing
Serializer which will accept the
key objects as input |
T |
setKeySerializer(java.lang.String keySerializerClassName)
The full name of the class implementing
Serializer which will accept the key
objects as input |
T |
setLingerMs(long lingerMs)
Sets the time to wait in milliseconds before sending a created batch.
|
T |
setMessageBufferSize(int messageBufferSize)
The size of the message buffer.
|
T |
setMessageBufferWaitTimeout(int messageBufferWaitTimeout)
Set the amount of time to wait for the message buffer before dropping the message
|
T |
setOrderingStrategy(OrderingStrategy orderingStrategy)
Sets the ordering strategy to be used by the producer.
|
T |
setProxyChain(ProxyChain proxyChain)
Configures the proxy chain to initialize for this producer.
|
T |
setValueSerializer(org.apache.kafka.common.serialization.Serializer<V> valueSerializer)
The configured class or instance implementing
Serializer which will accept the
value objects as input |
T |
setValueSerializer(java.lang.String valueSerializerClassName)
The full name of the class implementing
Serializer which will accept the value
objects as input |
void |
validate()
Validate the variables set in the config object.
|
protected DeliveryStrategy deliveryStrategy
protected OrderingStrategy orderingStrategy
protected java.lang.Boolean blocking
protected java.lang.Integer messageBufferSize
protected int messageBufferWaitTimeout
protected java.lang.Object keySerializer
protected java.lang.Object valueSerializer
protected int batchSize
protected long lingerMs
protected ProxyChain proxyChain
public T setDeliveryStrategy(DeliveryStrategy deliveryStrategy)
DeliveryStrategy for
the available strategies.deliveryStrategy - the strategy to use for the producerBaseProducerConfig.Builder object to be used for further configurationpublic T setOrderingStrategy(OrderingStrategy orderingStrategy)
OrderingStrategy for
the available strategies.orderingStrategy - the strategy to use for the producerBaseProducerConfig.Builder object to be used for further configurationpublic T setBlocking(boolean blocking)
blocking - the blockingBaseProducerConfig.Builder object to be used for further configurationpublic T setMessageBufferSize(int messageBufferSize)
messageBufferSize - the message buffer sizeBaseProducerConfig.Builder object to be used for further configurationpublic T setMessageBufferWaitTimeout(int messageBufferWaitTimeout)
messageBufferWaitTimeout - amount of time to wait in millisecondsBaseProducerConfig.Builder object to be used for further configurationpublic T setKeySerializer(java.lang.String keySerializerClassName)
Serializer which will accept the key
objects as inputkeySerializerClassName - The configured key serializer the producer should useBaseProducerConfig.Builder object to be used for further configurationpublic T setKeySerializer(org.apache.kafka.common.serialization.Serializer<K> keySerializer)
Serializer which will accept the
key objects as inputkeySerializer - The configured key serializer the producer should useBaseProducerConfig.Builder object to be used for further configurationpublic T setValueSerializer(java.lang.String valueSerializerClassName)
Serializer which will accept the value
objects as inputvalueSerializerClassName - The configured value serializer the producer should useBaseProducerConfig.Builder object to be used for further configurationpublic T setValueSerializer(org.apache.kafka.common.serialization.Serializer<V> valueSerializer)
Serializer which will accept the
value objects as inputvalueSerializer - The configured value serializer the producer should useBaseProducerConfig.Builder object to be used for further configurationpublic T setBatchSize(int batchSize)
setLingerMs(long) also plays a role in the
batching of messagesbatchSize - The batch size in bytesBaseProducerConfig.Builder object to be used for further configurationpublic T setLingerMs(long lingerMs)
lingerMs - The amount of milliseconds to wait to send a batchBaseProducerConfig.Builder object to be used for further configurationpublic T setProxyChain(ProxyChain proxyChain)
proxyChain - The chain of producer proxies to set up.BaseProducerConfig.Builder object to be used for further configurationpublic void validate()
java.lang.IllegalStateException - when one of more variables are not set (correctly)public BaseProducerConfig<K,V> build()
BaseProducerConfig object which is used by the AxualClient to
configure a producerBaseProducerConfig objectCopyright © 2020–2021 Axual B.V.. All rights reserved.