Merge branch '1.5.x'
This commit is contained in:
@@ -581,6 +581,7 @@ content into your application; rather pick only the properties that you need.
|
||||
spring.data.neo4j.open-in-view=false # Register OpenSessionInViewInterceptor. Binds a Neo4j Session to the thread for the entire processing of the request.
|
||||
spring.data.neo4j.password= # Login password of the server.
|
||||
spring.data.neo4j.repositories.enabled=true # Enable Neo4j repositories.
|
||||
spring.data.neo4j.transaction.*= # Transaction manager settings
|
||||
spring.data.neo4j.uri= # URI used by the driver. Auto-detected by default.
|
||||
spring.data.neo4j.username= # Login user of the server.
|
||||
|
||||
@@ -622,6 +623,7 @@ content into your application; rather pick only the properties that you need.
|
||||
spring.datasource.separator=; # Statement separator in SQL initialization scripts.
|
||||
spring.datasource.sql-script-encoding= # SQL scripts encoding.
|
||||
spring.datasource.tomcat.*= # Tomcat datasource specific settings
|
||||
spring.datasource.transaction.*= # Transaction manager settings
|
||||
spring.datasource.type= # Fully qualified name of the connection pool implementation to use. By default, it is auto-detected from the classpath.
|
||||
spring.datasource.url= # JDBC url of the database.
|
||||
spring.datasource.username=
|
||||
@@ -656,10 +658,12 @@ content into your application; rather pick only the properties that you need.
|
||||
spring.jpa.open-in-view=true # Register OpenEntityManagerInViewInterceptor. Binds a JPA EntityManager to the thread for the entire processing of the request.
|
||||
spring.jpa.properties.*= # Additional native properties to set on the JPA provider.
|
||||
spring.jpa.show-sql=false # Enable logging of SQL statements.
|
||||
spring.jpa.transaction.*= # Transaction manager settings
|
||||
|
||||
# JTA ({sc-spring-boot-autoconfigure}/transaction/jta/JtaAutoConfiguration.{sc-ext}[JtaAutoConfiguration])
|
||||
spring.jta.enabled=true # Enable JTA support.
|
||||
spring.jta.log-dir= # Transaction logs directory.
|
||||
spring.jta.transaction.*= # Transaction manager settings
|
||||
spring.jta.transaction-manager-id= # Transaction manager unique identifier.
|
||||
|
||||
# ATOMIKOS ({sc-spring-boot}/jta/atomikos/AtomikosProperties.{sc-ext}[AtomikosProperties])
|
||||
@@ -793,8 +797,10 @@ content into your application; rather pick only the properties that you need.
|
||||
spring.redis.cluster.max-redirects= # Maximum number of redirects to follow when executing commands across the cluster.
|
||||
spring.redis.cluster.nodes= # Comma-separated list of "host:port" pairs to bootstrap from.
|
||||
spring.redis.database=0 # Database index used by the connection factory.
|
||||
spring.redis.url= # Connection URL, will override host, port and password (user will be ignored), e.g. redis://user:password@example.com:6379
|
||||
spring.redis.host=localhost # Redis server host.
|
||||
spring.redis.password= # Login password of the redis server.
|
||||
spring.redis.ssl=false # Enable SSL support.
|
||||
spring.redis.pool.max-active=8 # Max number of connections that can be allocated by the pool at a given time. Use a negative value for no limit.
|
||||
spring.redis.pool.max-idle=8 # Max number of "idle" connections in the pool. Use a negative value to indicate an unlimited number of idle connections.
|
||||
spring.redis.pool.max-wait=-1 # Maximum amount of time (in milliseconds) a connection allocation should block before throwing an exception when the pool is exhausted. Use a negative value to block indefinitely.
|
||||
@@ -842,6 +848,7 @@ content into your application; rather pick only the properties that you need.
|
||||
spring.batch.job.names= # Comma-separated list of job names to execute on startup (For instance `job1,job2`). By default, all Jobs found in the context are executed.
|
||||
spring.batch.schema=classpath:org/springframework/batch/core/schema-@@platform@@.sql # Path to the SQL file to use to initialize the database schema.
|
||||
spring.batch.table-prefix= # Table prefix for all the batch meta-data tables.
|
||||
spring.batch.transaction.*= # Transaction manager settings
|
||||
|
||||
# JMS ({sc-spring-boot-autoconfigure}/jms/JmsProperties.{sc-ext}[JmsProperties])
|
||||
spring.jms.jndi-name= # Connection factory JNDI name. When set, takes precedence to others connection factory auto-configurations.
|
||||
@@ -871,6 +878,7 @@ content into your application; rather pick only the properties that you need.
|
||||
spring.kafka.consumer.group-id= # Unique string that identifies the consumer group this consumer belongs to.
|
||||
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-messages= # Maximum number of records returned in a single call to poll().
|
||||
spring.kafka.consumer.value-deserializer= # Deserializer class for values.
|
||||
spring.kafka.listener.ack-count= # Number of records between offset commits when ackMode is "COUNT" or "COUNT_TIME".
|
||||
spring.kafka.listener.ack-mode= # Listener AckMode; see the spring-kafka documentation.
|
||||
@@ -886,6 +894,7 @@ content into your application; rather pick only the properties that you need.
|
||||
spring.kafka.producer.key-serializer= # Serializer class for keys.
|
||||
spring.kafka.producer.retries= # When greater than zero, enables retrying of failed sends.
|
||||
spring.kafka.producer.value-serializer= # Serializer class for values.
|
||||
spring.kafka.properties.*= # Additional properties used to configure the client.
|
||||
spring.kafka.ssl.key-password= # Password of the private key in the key store file.
|
||||
spring.kafka.ssl.keystore-location= # Location of the key store file.
|
||||
spring.kafka.ssl.keystore-password= # Store password for the key store file.
|
||||
|
||||
@@ -634,6 +634,10 @@ for Gradle and to `${project.name}` for Maven.
|
||||
|`useStartStopDaemon`
|
||||
|If the `start-stop-daemon` command, when it's available, should be used to control the
|
||||
process. Defaults to `true`.
|
||||
|
||||
|`stopWaitTime`
|
||||
|The default value for `STOP_WAIT_TIME`. Only valid for an `init.d` service.
|
||||
Defaults to 60 seconds.
|
||||
|===
|
||||
|
||||
|
||||
@@ -694,6 +698,10 @@ The following environment properties are supported with the default script:
|
||||
|`DEBUG`
|
||||
|if not empty will set the `-x` flag on the shell process, making it easy to see the logic
|
||||
in the script.
|
||||
|
||||
|`STOP_WAIT_TIME`
|
||||
|The time in seconds to wait when stopping the application before forcing a shutdown
|
||||
(`60` by default).
|
||||
|===
|
||||
|
||||
NOTE: The `PID_FOLDER`, `LOG_FOLDER` and `LOG_FILENAME` variables are only valid for an
|
||||
|
||||
@@ -4604,18 +4604,23 @@ auto configuration supports all HIGH importance properties, some selected MEDIUM
|
||||
and any that do not have a default value.
|
||||
|
||||
Only a subset of the properties supported by Kafka are available via the `KafkaProperties`
|
||||
class. If you wish to configure the producer or consumer with additional properties, you
|
||||
can override the producer factory and/or consumer factory bean, adding additional
|
||||
properties, for example:
|
||||
class. If you wish to configure the producer or consumer with additional properties that
|
||||
are not directly supported, use the following:
|
||||
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
spring.kafka.properties.foo.bar=baz
|
||||
----
|
||||
|
||||
This sets the common `foo.bar` Kafka property to `baz`.
|
||||
|
||||
These properties will be shared by both the consumer and producer factory beans.
|
||||
If you wish to customize these components with different properties, such as to use a
|
||||
different metrics reader for each, you can override the bean definitions, as follows:
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
@Bean
|
||||
public ProducerFactory<?, ?> kafkaProducerFactory(KafkaProperties properties) {
|
||||
Map<String, Object> producerProperties = properties.buildProducerProperties();
|
||||
producerProperties.put("some.property", "some.value");
|
||||
return new DefaultKafkaProducerFactory<Object, Object>(producerProperties);
|
||||
}
|
||||
include::{code-examples}/kafka/KafkaSpecialProducerConsumerConfigExample.java[tag=configuration]
|
||||
----
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright 2016-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.kafka;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.kafka.clients.CommonClientConfigs;
|
||||
import org.apache.kafka.common.metrics.KafkaMetric;
|
||||
import org.apache.kafka.common.metrics.MetricsReporter;
|
||||
|
||||
import org.springframework.boot.autoconfigure.kafka.KafkaProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.kafka.core.ConsumerFactory;
|
||||
import org.springframework.kafka.core.DefaultKafkaConsumerFactory;
|
||||
import org.springframework.kafka.core.DefaultKafkaProducerFactory;
|
||||
import org.springframework.kafka.core.ProducerFactory;
|
||||
|
||||
/**
|
||||
* Example custom kafka configuration beans used when the user wants to apply different
|
||||
* common properties to the producer and consumer.
|
||||
*
|
||||
* @author Gary Russell
|
||||
* @since 1.5
|
||||
*/
|
||||
public class KafkaSpecialProducerConsumerConfigExample {
|
||||
|
||||
// tag::configuration[]
|
||||
@Configuration
|
||||
public static class CustomKafkaBeans {
|
||||
|
||||
/**
|
||||
* Customized ProducerFactory bean.
|
||||
* @param properties the kafka properties.
|
||||
* @return the bean.
|
||||
*/
|
||||
@Bean
|
||||
public ProducerFactory<?, ?> kafkaProducerFactory(KafkaProperties properties) {
|
||||
Map<String, Object> producerProperties = properties.buildProducerProperties();
|
||||
producerProperties.put(CommonClientConfigs.METRIC_REPORTER_CLASSES_CONFIG,
|
||||
MyProducerMetricsReporter.class);
|
||||
return new DefaultKafkaProducerFactory<Object, Object>(producerProperties);
|
||||
}
|
||||
|
||||
/**
|
||||
* Customized ConsumerFactory bean.
|
||||
* @param properties the kafka properties.
|
||||
* @return the bean.
|
||||
*/
|
||||
@Bean
|
||||
public ConsumerFactory<?, ?> kafkaConsumerFactory(KafkaProperties properties) {
|
||||
Map<String, Object> consumererProperties = properties
|
||||
.buildConsumerProperties();
|
||||
consumererProperties.put(CommonClientConfigs.METRIC_REPORTER_CLASSES_CONFIG,
|
||||
MyConsumerMetricsReporter.class);
|
||||
return new DefaultKafkaConsumerFactory<Object, Object>(consumererProperties);
|
||||
}
|
||||
|
||||
}
|
||||
// end::configuration[]
|
||||
|
||||
public static class MyConsumerMetricsReporter implements MetricsReporter {
|
||||
|
||||
@Override
|
||||
public void configure(Map<String, ?> configs) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(List<KafkaMetric> metrics) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void metricChange(KafkaMetric metric) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void metricRemoval(KafkaMetric metric) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class MyProducerMetricsReporter implements MetricsReporter {
|
||||
|
||||
@Override
|
||||
public void configure(Map<String, ?> configs) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(List<KafkaMetric> metrics) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void metricChange(KafkaMetric metric) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void metricRemoval(KafkaMetric metric) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user