5. Binder-specific configuration

This captures the binder, consumer and producer properties that are specific for several binder implementations.

5.1 Rabbit-specific settings

5.1.1 Rabbit MQ Binder properties

The binder supports the all Spring Boot properties for Rabbit MQ configuration.

In addition to that, it also supports the following properties:

spring.cloud.stream.rabbit.binder.addresses
A comma-separated list of RabbitMQ server addresses (used only for clustering and in conjunction with nodes). Default empty. spring.cloud.stream.rabbit.binder.adminAddresses. Default empty. A comma-separated list of RabbitMQ management plugin URLs - only used when nodes contains more than one entry. Entries in this list must correspond to the corresponding entry in addresses. Default empty.
spring.cloud.stream.rabbit.binder.nodes
A comma-separated list of RabbitMQ node names; when more than one entry, used to locate the server address where a queue is located. Entries in this list must correspond to the corresponding entry in addresses. Default empty.
spring.cloud.stream.rabbit.rabbit.username
The user name. Default null.
spring.cloud.stream.rabbit.binder.password
The password. Default null.
spring.cloud.stream.rabbit.binder.vhost
The virtual host. Default null.
spring.cloud.stream.rabbit.binder.useSSL
True if Rabbit MQ should use SSL.
spring.cloud.stream.rabbit.binder.sslPropertiesLocation
The location of the SSL properties file, when certificate exchange is used.
spring.cloud.stream.rabbit.binder.compressionLevel
Compression level for compressed bindings. Defaults to 1 (BEST_LEVEL). See java.util.zip.Deflater.

5.1.2 Rabbit MQ Consumer Properties

The following properties are available for Rabbit consumers only and must be prefixed with spring.cloud.stream.rabbit.bindings.<channelName>.consumer .

acknowledgeMode
The acknowledge mode. Default AUTO.
autoBindDlq
Whether to automatically declare the DLQ and bind it to the binder DLX. Default false.
durableSubscription
Whether subscription should be durable. Only effective if group is also set. Default true. maxConcurrency: Default 1. prefetch: Prefetch count. Default 1.
prefix
A prefix to be added to the name of the destination and queues. Default "".
requeueRejected
Whether delivery failures should be requeued. Default true.
requestHeaderPatterns
The request headers to be transported. Default [STANDARD_REQUEST_HEADERS,'*'].
replyHeaderPatterns
The reply headers to be transported. Default [STANDARD_REQUEST_HEADERS,'*']
republishToDlq
By default, failed messages after retries are exhausted are rejected. If a dead-letter queue (DLQ) is configured, rabbitmq will route the failed message (unchanged) to the DLQ. Setting this property to true instructs the bus to republish failed messages to the DLQ, with additional headers, including the exception message and stack trace from the cause of the final failure.
transacted
Whether to use transacted channels. Default false.
txSize
The number of deliveries between acks. Default 1.

5.1.3 Rabbit Producer Properties

The following properties are available for Rabbit producers only and must be prefixed with spring.cloud.stream.rabbit.bindings.<channelName>.producer .

autoBindDlq
Whether to automatically declare the DLQ and bind it to the binder DLX. Default false.
batchingEnabled
True to enable message batching by producers. Default false.
batchSize
The number of message to buffer when batching is enabled. Default 100.
batchBufferLimit
Default 10000.
batchTimeout
Default 5000.
compress
Whether data should be compressed when sent. Default false.
deliveryMode
Delivery mode. Default PERSISTENT.
prefix
A prefix to be added to the name of the destination exchange. Default "".
requestHeaderPatterns
The request headers to be transported. Default [STANDARD_REQUEST_HEADERS,'*'].
replyHeaderPatterns
The reply headers to be transported. Default [STANDARD_REQUEST_HEADERS,'*']

5.2 Kafka-specific settings

5.2.1 Kafka binder properties

spring.cloud.stream.kafka.binder.brokers
A list of brokers that the Kafka binder will connect to. Default localhost.
spring.cloud.stream.kafka.binder.defaultBrokerPort
The list of brokers allows to specify hosts with or without port information, i.e. host1,host2:port2. This configuration sets the default port when no port is configured in the broker list. Default 9092.
spring.cloud.stream.kafka.binder.zkNodes
A list of Zookeeper nodes for the Kafka binder to connect to. Default localhost.
spring.cloud.stream.kafka.binder.defaultZkPort
The list of Zookeeper nodes allows to specify hosts with or without port information, i.e. host1,host2:port2. This configuration sets the default port when no port is configured in the node list. Default 2181.
spring.cloud.stream.kafka.binder.headers
The list of custom that will be transported by the binder. Default empty.
spring.cloud.stream.kafka.binder.offsetUpdateTimeWindow
The frequency in milliseconds with which offsets are saved. Ignored if 0. Default 10000.
spring.cloud.stream.kafka.binder.offsetUpdateCount
The frequency in number of updates, which which consumed offsets are persisted. Ignored if 0. Default 0. Mutually exclusive with offsetUpdateTimeWindow.
spring.cloud.stream.kafka.binder.requiredAcks
The number of required acks on the broker.

5.2.2 Kafka Consumer Properties

The following properties are available for Kafka consumers only and must be prefixed with spring.cloud.stream.kafka.bindings.<channelName>.consumer .

autoCommitOffset
True to autocommit offsets when a message has been processed. If set to false, an Acknowledgment header will be available in the message headers for late acknowledgment. Default true.
mode
When set to raw, will disable header parsing on input. Useful when inbound data is coming from outside Spring Cloud Stream applications. Default embeddedHeaders.
resetOffsets
True to reset offsets on the consumer to the value provided by startOffset. Default false.
startOffset
The starting offset for new groups or when resetOffsets is true. Allowed values: earliest,latest. Defaults to null (equivalent to earliest).
minPartitionCount
The minimum number of partitions expected by the consumer if it creates the consumed topic automatically. Defaults to 1.

5.2.3 Kafka Producer Properties

The following properties are available for Kafka producers only and must be prefixed with spring.cloud.stream.kafka.bindings.<channelName>.producer .

bufferSize
This is an upper limit of how much data the Kafka Producer will attempt to batch before sending – specified in bytes. Default 16384.
sync
Whether the producer is synchronous. Defaults to false.
batchTimeout
How long will the producer wait before sending in order to allow more messages to get accumulated in the same batch. Normally the producer will not wait at all, and simply send all the messages that accumulated while the previous send was in progress. A non-zero value may increase throughput at the expense of latency. Default 0.
mode
When set to raw, disable header propagation on output. Useful when producing data for non-Spring Cloud Stream applications. Default embeddedHeaders.