replaced CodecConfiguration with spring.factories
add new line
This commit is contained in:
committed by
Ilayaperumal Gopinathan
parent
4be452c089
commit
05e12efb84
@@ -19,10 +19,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cloud.stream.binder.kafka.KafkaMessageChannelBinder;
|
||||
import org.springframework.cloud.stream.config.codec.CodecConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.integration.codec.Codec;
|
||||
import org.springframework.integration.kafka.support.ZookeeperConnect;
|
||||
|
||||
@@ -30,50 +28,49 @@ import org.springframework.integration.kafka.support.ZookeeperConnect;
|
||||
* @author David Turanski
|
||||
*/
|
||||
@Configuration
|
||||
@Import(CodecConfiguration.class)
|
||||
@EnableConfigurationProperties(KafkaBinderConfigurationProperties.class)
|
||||
@ConfigurationProperties(prefix = "spring.cloud.stream.binder.kafka")
|
||||
public class KafkaMessageChannelBinderConfiguration {
|
||||
|
||||
|
||||
private String zkAddress;
|
||||
|
||||
private String brokers;
|
||||
|
||||
|
||||
private String brokers;
|
||||
|
||||
private KafkaMessageChannelBinder.Mode mode;
|
||||
|
||||
|
||||
private String offsetStoreTopic;
|
||||
|
||||
|
||||
private int offsetStoreSegmentSize;
|
||||
|
||||
|
||||
private int offsetStoreRetentionTime;
|
||||
|
||||
|
||||
private int offsetStoreRequiredAcks;
|
||||
|
||||
|
||||
private int offsetStoreMaxFetchSize;
|
||||
|
||||
|
||||
private int offsetStoreBatchBytes;
|
||||
|
||||
|
||||
private int offsetStoreBatchTime;
|
||||
|
||||
|
||||
private int offsetUpdateTimeWindow;
|
||||
|
||||
|
||||
private int offsetUpdateCount;
|
||||
|
||||
|
||||
private int offsetUpdateShutdownTimeout;
|
||||
|
||||
|
||||
@Autowired
|
||||
private Codec codec;
|
||||
|
||||
|
||||
@Autowired
|
||||
private KafkaBinderConfigurationProperties kafkaBinderConfigurationProperties;
|
||||
|
||||
|
||||
@Bean
|
||||
ZookeeperConnect zookeeperConnect() {
|
||||
ZookeeperConnect zookeeperConnect = new ZookeeperConnect();
|
||||
zookeeperConnect.setZkConnect(zkAddress);
|
||||
return zookeeperConnect;
|
||||
return zookeeperConnect;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
KafkaMessageChannelBinder kafkaMessageChannelBinder() {
|
||||
KafkaMessageChannelBinder kafkaMessageChannelBinder = new KafkaMessageChannelBinder(zookeeperConnect(),
|
||||
@@ -90,7 +87,7 @@ public class KafkaMessageChannelBinderConfiguration {
|
||||
kafkaMessageChannelBinder.setOffsetUpdateTimeWindow(offsetUpdateTimeWindow);
|
||||
kafkaMessageChannelBinder.setOffsetUpdateCount(offsetUpdateCount);
|
||||
kafkaMessageChannelBinder.setOffsetUpdateShutdownTimeout(offsetUpdateShutdownTimeout);
|
||||
|
||||
|
||||
kafkaMessageChannelBinder.setDefaultAutoCommitEnabled(kafkaBinderConfigurationProperties.isAutoCommitEnabled());
|
||||
kafkaMessageChannelBinder.setDefaultBatchSize(kafkaBinderConfigurationProperties.getBatchSize());
|
||||
kafkaMessageChannelBinder.setDefaultBatchTimeout(kafkaBinderConfigurationProperties.getBatchTimeout());
|
||||
@@ -101,9 +98,10 @@ public class KafkaMessageChannelBinderConfiguration {
|
||||
kafkaMessageChannelBinder.setDefaultMinPartitionCount(kafkaBinderConfigurationProperties
|
||||
.getMinPartitionCount());
|
||||
kafkaMessageChannelBinder.setDefaultQueueSize(kafkaBinderConfigurationProperties.getQueueSize());
|
||||
kafkaMessageChannelBinder.setDefaultReplicationFactor(kafkaBinderConfigurationProperties.getReplicationFactor());
|
||||
kafkaMessageChannelBinder.setDefaultReplicationFactor(kafkaBinderConfigurationProperties
|
||||
.getReplicationFactor());
|
||||
kafkaMessageChannelBinder.setDefaultRequiredAcks(kafkaBinderConfigurationProperties.getRequiredAcks());
|
||||
|
||||
|
||||
return kafkaMessageChannelBinder;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,14 +27,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cloud.stream.binder.rabbit.ConnectionFactorySettings;
|
||||
import org.springframework.cloud.stream.binder.rabbit.RabbitMessageChannelBinder;
|
||||
import org.springframework.cloud.stream.config.codec.CodecConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.integration.codec.Codec;
|
||||
|
||||
@Configuration
|
||||
@Import(CodecConfiguration.class)
|
||||
@EnableConfigurationProperties({RabbitBinderConfigurationProperties.class})
|
||||
public class RabbitMessageChannelBinderConfiguration {
|
||||
|
||||
|
||||
@@ -19,10 +19,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cloud.stream.binder.redis.RedisMessageChannelBinder;
|
||||
import org.springframework.cloud.stream.config.codec.CodecConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.integration.codec.Codec;
|
||||
|
||||
@@ -30,7 +28,6 @@ import org.springframework.integration.codec.Codec;
|
||||
* @author David Turanski
|
||||
*/
|
||||
@Configuration
|
||||
@Import(CodecConfiguration.class)
|
||||
@EnableConfigurationProperties(RedisBinderConfigurationProperties.class)
|
||||
@ConfigurationProperties(prefix = "spring.cloud.stream.binder.redis")
|
||||
public class RedisMessageChannelBinderConfiguration {
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 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.cloud.stream.config.codec;
|
||||
|
||||
import org.springframework.cloud.stream.config.codec.kryo.KryoCodecAutoConfiguration;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
* Generic {@link org.springframework.integration.codec.Codec} configuration imported by the
|
||||
* Binder configuration. This is the default configuration for
|
||||
* <a href="https://github.com/EsotericSoftware/kryo">Kryo</a>. To provide an alternate Codec implementation,
|
||||
* remove this configuration from the classpath and replace this class to resolve the Binder configuration
|
||||
* reference.
|
||||
*
|
||||
* @author David Turanski
|
||||
*/
|
||||
@Configuration
|
||||
@Import(KryoCodecAutoConfiguration.class)
|
||||
public class CodecConfiguration {
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration:\
|
||||
org.springframework.cloud.stream.config.codec.kryo.KryoCodecAutoConfiguration
|
||||
Reference in New Issue
Block a user