public interface EnvironmentBuilder
Environment.EnvironmentBuilder| Modifier and Type | Interface and Description |
|---|---|
static interface |
EnvironmentBuilder.NettyConfiguration
Helper to configure Netty
|
static interface |
EnvironmentBuilder.TlsConfiguration
Helper to configure TLS.
|
| Modifier and Type | Method and Description |
|---|---|
EnvironmentBuilder |
addressResolver(AddressResolver addressResolver)
An
AddressResolver to potentially change resolved node address to connect to. |
Environment |
build()
Create the
Environment instance. |
EnvironmentBuilder |
chunkChecksum(ChunkChecksum chunkChecksum)
The checksum strategy used for chunk checksum.
|
EnvironmentBuilder |
clientProperties(Map<String,String> clientProperties)
Custom client properties to add to default client properties.
|
EnvironmentBuilder |
clientProperty(String key,
String value)
Add a custom client properties to default client properties.
|
EnvironmentBuilder |
codec(Codec codec)
The AMQP 1.0 codec used to encode and decode AMQP 1.0 messages.
|
EnvironmentBuilder |
compressionCodecFactory(CompressionCodecFactory compressionCodecFactory)
Compression codec factory to use for compression in sub-entry batching.
|
EnvironmentBuilder |
credentialsProvider(CredentialsProvider credentialsProvider)
The
CredentialsProvider to use. |
EnvironmentBuilder |
forceReplicaForConsumers(boolean forceReplica)
Flag to force the connection to a stream replica for consumers.
|
EnvironmentBuilder |
host(String host)
The host to connect to.
|
EnvironmentBuilder |
id(String id)
Informational ID for this environment instance.
|
EnvironmentBuilder |
lazyInitialization(boolean lazy)
To delay the connection opening until necessary.
|
EnvironmentBuilder |
maxConsumersByConnection(int maxConsumersByConnection)
The maximum number of consumers allocated to a single connection.
|
EnvironmentBuilder |
maxProducersByConnection(int maxProducersByConnection)
The maximum number of producers allocated to a single connection.
|
EnvironmentBuilder |
maxTrackingConsumersByConnection(int maxTrackingConsumersByConnection)
The maximum number of tracking consumers allocated to a single connection.
|
EnvironmentBuilder |
metricsCollector(MetricsCollector metricsCollector)
Set up a
MetricsCollector. |
EnvironmentBuilder.NettyConfiguration |
netty()
Helper to configure netty.
|
EnvironmentBuilder |
observationCollector(ObservationCollector<?> observationCollector)
Set up an
ObservationCollector. |
EnvironmentBuilder |
password(String password)
The password to use.
|
EnvironmentBuilder |
port(int port)
The port to use to connect.
|
EnvironmentBuilder |
recoveryBackOffDelayPolicy(BackOffDelayPolicy recoveryBackOffDelayPolicy)
The
BackOffDelayPolicy to use for connection recovery. |
EnvironmentBuilder |
requestedHeartbeat(Duration requestedHeartbeat)
The heartbeat to request.
|
EnvironmentBuilder |
requestedMaxFrameSize(int requestedMaxFrameSize)
The maximum frame size to request.
|
EnvironmentBuilder |
rpcTimeout(Duration timeout)
Timeout for RPC calls.
|
EnvironmentBuilder |
saslConfiguration(SaslConfiguration saslConfiguration)
The SASL configuration to use.
|
EnvironmentBuilder |
scheduledExecutorService(ScheduledExecutorService scheduledExecutorService)
Set the
ScheduledExecutorService used to:
Schedule producers batch sending
Handle connection recovery
Handle topology update
|
EnvironmentBuilder.TlsConfiguration |
tls()
Enable and configure TLS.
|
EnvironmentBuilder |
topologyUpdateBackOffDelayPolicy(BackOffDelayPolicy topologyUpdateBackOffDelayPolicy)
The
BackOffDelayPolicy to use for topology recovery. |
EnvironmentBuilder |
uri(String uri)
The URI of a node to connect to.
|
EnvironmentBuilder |
uris(List<String> uris)
A list of URIs of nodes of the same cluster to use to connect to.
|
EnvironmentBuilder |
username(String username)
The username to use.
|
EnvironmentBuilder |
virtualHost(String virtualHost)
The virtual host to connect to.
|
EnvironmentBuilder uri(String uri)
URI must be of the form rabbitmq-stream://guest:guest@localhost:5552/%2f.
uri - EnvironmentBuilder uris(List<String> uris)
URIs must be of the form rabbitmq-stream://guest:guest@localhost:5552/%2f.
uris - EnvironmentBuilder addressResolver(AddressResolver addressResolver)
AddressResolver to potentially change resolved node address to connect to.
Applications can use this abstraction to make sure connection attempts ignore metadata hints and always go to a single point like a load balancer.
The default implementation does not perform any logic, it just returns the passed-in address.
The default implementation is overridden automatically if the following conditions are
met: the host to connect to is localhost, the user is guest, and no
address resolver has been provided. The client will then always tries to connect to
localhost to facilitate local development. Just provide a pass-through address resolver
to avoid this behavior, e.g.:
Environment.builder() .addressResolver(address -> address) .build();
addressResolver - EnvironmentBuilder host(String host)
host - EnvironmentBuilder port(int port)
port - EnvironmentBuilder codec(Codec codec)
codec - EnvironmentBuilder id(String id)
This is currently used as a prefix for connection names. The broker does not enforce any
kind of uniqueness based on this property. Default to rabbitmq-stream.
id - EnvironmentBuilder compressionCodecFactory(CompressionCodecFactory compressionCodecFactory)
compressionCodecFactory - ProducerBuilder.subEntrySize(int),
ProducerBuilder.compression(Compression)EnvironmentBuilder rpcTimeout(Duration timeout)
Default is 10 seconds.
timeout - EnvironmentBuilder saslConfiguration(SaslConfiguration saslConfiguration)
saslConfiguration - credentialsProvider(CredentialsProvider)EnvironmentBuilder credentialsProvider(CredentialsProvider credentialsProvider)
CredentialsProvider to use.credentialsProvider - saslConfiguration(SaslConfiguration)EnvironmentBuilder username(String username)
username - EnvironmentBuilder password(String password)
password - EnvironmentBuilder virtualHost(String virtualHost)
virtualHost - EnvironmentBuilder requestedHeartbeat(Duration requestedHeartbeat)
Default is 60 seconds.
requestedHeartbeat - EnvironmentBuilder requestedMaxFrameSize(int requestedMaxFrameSize)
Default is 1048576.
requestedMaxFrameSize - EnvironmentBuilder chunkChecksum(ChunkChecksum chunkChecksum)
The default is CRC32 based on JDK implementation.
chunkChecksum - EnvironmentBuilder clientProperties(Map<String,String> clientProperties)
clientProperties - EnvironmentBuilder clientProperty(String key, String value)
key - value - EnvironmentBuilder metricsCollector(MetricsCollector metricsCollector)
MetricsCollector.metricsCollector - EnvironmentBuilder observationCollector(ObservationCollector<?> observationCollector)
ObservationCollector.observationCollector - EnvironmentBuilder maxProducersByConnection(int maxProducersByConnection)
Default is 256, which is the maximum value.
The limit may not be strictly enforced in case of too many concurrent creations.
maxProducersByConnection - EnvironmentBuilder maxTrackingConsumersByConnection(int maxTrackingConsumersByConnection)
Default is 50, which is the maximum value.
The limit may not be strictly enforced in case of too many concurrent creations.
maxTrackingConsumersByConnection - EnvironmentBuilder maxConsumersByConnection(int maxConsumersByConnection)
Default is 256, which is the maximum value.
The limit may not be strictly enforced in case of too many concurrent creations.
maxConsumersByConnection - EnvironmentBuilder scheduledExecutorService(ScheduledExecutorService scheduledExecutorService)
ScheduledExecutorService used to:
scheduledExecutorService - the service to useEnvironmentBuilder recoveryBackOffDelayPolicy(BackOffDelayPolicy recoveryBackOffDelayPolicy)
BackOffDelayPolicy to use for connection recovery.
The default is a fixed delay of 5 seconds.
recoveryBackOffDelayPolicy - EnvironmentBuilder topologyUpdateBackOffDelayPolicy(BackOffDelayPolicy topologyUpdateBackOffDelayPolicy)
BackOffDelayPolicy to use for topology recovery.
Topology recovery can kick in when streams leaders and replicas move from nodes to nodes in the cluster.
The default is a first delay of 5 seconds, then 1 second for the next attempts.
topologyUpdateBackOffDelayPolicy - EnvironmentBuilder lazyInitialization(boolean lazy)
No connection will be open before it is necessary (for stream management or producer/consumer creation).
Default is false.
lazy - EnvironmentBuilder forceReplicaForConsumers(boolean forceReplica)
The library will always prefer to connect to a stream replica to consume from, but it will
fall back to the stream leader if no replica is available. This is the default behavior. Set
this flag to true to make the library wait for a replica to become available if
only the stream leader is available. This can lead to longer recovery time but help to offload
a stream leader and let it deal only with write requests.
Note the library performs only 5 attempts to locate a replica before falling back to the
leader when the flag is set to true.
The recoveryBackOffDelayPolicy(BackOffDelayPolicy) and topologyUpdateBackOffDelayPolicy(BackOffDelayPolicy) policies control the time between
attempts.
Do not set this flag to true when streams have only 1 member (the leader),
e.g. for local development.
Default is false.
forceReplica - whether to force the connection to a replica or notrecoveryBackOffDelayPolicy(BackOffDelayPolicy),
topologyUpdateBackOffDelayPolicy(BackOffDelayPolicy)Environment build()
Environment instance.EnvironmentBuilder.TlsConfiguration tls()
EnvironmentBuilder.NettyConfiguration netty()
Copyright © 2024 Broadcom Inc. and/or its subsidiaries. All rights reserved.