Polish "Add support for arbitrary producer/consumer Kafka properties"

Closes gh-9775
pull/9781/merge
Stephane Nicoll 7 years ago
parent 191752d2c0
commit 38ad582959

@ -66,7 +66,7 @@ public class KafkaProperties {
* Additional properties, common to producers and consumers, used to configure the
* client.
*/
private Map<String, String> properties = new HashMap<>();
private final Map<String, String> properties = new HashMap<>();
private final Consumer consumer = new Consumer();
@ -100,10 +100,6 @@ public class KafkaProperties {
return this.properties;
}
public void setProperties(Map<String, String> properties) {
this.properties = properties;
}
public Consumer getConsumer() {
return this.consumer;
}
@ -270,9 +266,9 @@ public class KafkaProperties {
private Integer maxPollRecords;
/**
* Additional properties used to configure the client.
* Additional consumer-specific properties used to configure the client.
*/
private Map<String, String> properties = new HashMap<>();
private final Map<String, String> properties = new HashMap<>();
public Ssl getSsl() {
return this.ssl;
@ -378,10 +374,6 @@ public class KafkaProperties {
return this.properties;
}
public void setProperties(Map<String, String> properties) {
this.properties = properties;
}
public Map<String, Object> buildProperties() {
Map<String, Object> properties = new HashMap<>();
if (this.autoCommitInterval != null) {
@ -508,9 +500,9 @@ public class KafkaProperties {
private Integer retries;
/**
* Additional properties used to configure the client.
* Additional producer-specific properties used to configure the client.
*/
private Map<String, String> properties = new HashMap<>();
private final Map<String, String> properties = new HashMap<>();
public Ssl getSsl() {
return this.ssl;
@ -592,10 +584,6 @@ public class KafkaProperties {
return this.properties;
}
public void setProperties(Map<String, String> properties) {
this.properties = properties;
}
public Map<String, Object> buildProperties() {
Map<String, Object> properties = new HashMap<>();
if (this.acks != null) {

@ -968,7 +968,7 @@ content into your application; rather pick only the properties that you need.
spring.kafka.consumer.heartbeat-interval= # Expected time in milliseconds between heartbeats to the consumer coordinator.
spring.kafka.consumer.key-deserializer= # Deserializer class for keys.
spring.kafka.consumer.max-poll-records= # Maximum number of records returned in a single call to poll().
spring.kafka.consumer.properties.*= # Additional properties used to configure the client.
spring.kafka.consumer.properties.*= # Additional consumer-specific properties used to configure the client.
spring.kafka.consumer.ssl.key-password= # Password of the private key in the key store file.
spring.kafka.consumer.ssl.keystore-location= # Location of the key store file.
spring.kafka.consumer.ssl.keystore-password= # Store password for the key store file.
@ -992,7 +992,7 @@ content into your application; rather pick only the properties that you need.
spring.kafka.producer.client-id= # Id to pass to the server when making requests; used for server-side logging.
spring.kafka.producer.compression-type= # Compression type for all data generated by the producer.
spring.kafka.producer.key-serializer= # Serializer class for keys.
spring.kafka.producer.properties.*= # Additional properties used to configure the client.
spring.kafka.producer.properties.*= # Additional producer-specific properties used to configure the client.
spring.kafka.producer.retries= # When greater than zero, enables retrying of failed sends.
spring.kafka.producer.ssl.key-password= # Password of the private key in the key store file.
spring.kafka.producer.ssl.keystore-location= # Location of the key store file.

@ -5121,9 +5121,12 @@ are not directly supported, use the following:
spring,kafka.producer.properties.baz.qux=fiz
----
This sets the common `foo.bar` Kafka property to `baz` (applies to both producers and consumers), the consumer `fiz.buz` property to `qux` and the `baz.qux` producer property to `fiz`.
This sets the common `foo.bar` Kafka property to `baz` (applies to both producers and
consumers), the consumer `fiz.buz` property to `qux` and the `baz.qux` producer property
to `fiz`.
IMPORTANT: Properties set in this way will override properties that are in the subset that boot explicitly supports.
IMPORTANT: Properties set in this way will override any configuration item that Spring
Boot explicitly supports.
[[boot-features-resttemplate]]
== Calling REST services with '`RestTemplate`'

Loading…
Cancel
Save