XD-3445 Fix Kafka Binder

- add autoconfiguration support and missing configuration properties
- add version in pom.xml
- fix dependency on spring-cloud-stream-binder-test
This commit is contained in:
Marius Bogoevici
2015-08-31 22:37:21 -04:00
parent 610cf5608d
commit 3eeeaec160
6 changed files with 86 additions and 0 deletions

View File

@@ -83,6 +83,11 @@
<artifactId>spring-cloud-stream-binder-rabbit</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-kafka</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-test</artifactId>

View File

@@ -43,6 +43,7 @@
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>

View File

@@ -0,0 +1,35 @@
/*
* Copyright 2015 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.binder.kafka.config;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.test.ImportAutoConfiguration;
import org.springframework.cloud.stream.binder.Binder;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
/**
* Bind to Kafka services.
*
* @author Marius Bogoevici
*/
@Configuration
@ConditionalOnMissingBean(Binder.class)
@ImportAutoConfiguration(KafkaMessageChannelBinderConfiguration.class)
@PropertySource("classpath:/META-INF/spring-cloud-stream/kafka-binder.properties")
public class KafkaServiceAutoConfiguration {
}

View File

@@ -0,0 +1,20 @@
/*
* Copyright 2015 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.
*/
/**
* This package contains an implementation of the {@link org.springframework.cloud.stream.binder.Binder} for Kafka.
*/
package org.springframework.cloud.stream.binder.kafka;

View File

@@ -0,0 +1,23 @@
spring.cloud.stream.binder.kafka.brokers=localhost:9092
spring.cloud.stream.binder.kafka.zkAddress=localhost:2181
spring.cloud.stream.binder.kafka.mode=embeddedHeaders
spring.cloud.stream.binder.kafka.offsetStoreTopic=SpringXdOffsets
spring.cloud.stream.binder.kafka.offsetStoreSegmentSize=25000000
spring.cloud.stream.binder.kafka.offsetStoreRetentionTime=60000
spring.cloud.stream.binder.kafka.offsetStoreRequiredAcks=1
spring.cloud.stream.binder.kafka.offsetStoreMaxFetchSize=1048576
spring.cloud.stream.binder.kafka.offsetStoreBatchBytes=16384
spring.cloud.stream.binder.kafka.offsetStoreBatchTime=1000
spring.cloud.stream.binder.kafka.offsetUpdateTimeWindow=10000
spring.cloud.stream.binder.kafka.offsetUpdateCount=0
spring.cloud.stream.binder.kafka.offsetUpdateShutdownTimeout=2000
spring.cloud.stream.binder.kafka.default.batchSize=16384
spring.cloud.stream.binder.kafka.default.batchTimeout=0
spring.cloud.stream.binder.kafka.default.requiredAcks=1
spring.cloud.stream.binder.kafka.default.replicationFactor=1
spring.cloud.stream.binder.kafka.default.concurrency=1
spring.cloud.stream.binder.kafka.default.compressionCodec=none
spring.cloud.stream.binder.kafka.default.autoCommitEnabled=true
spring.cloud.stream.binder.kafka.default.fetchSize=1048576
spring.cloud.stream.binder.kafka.default.minPartitionCount=1
spring.cloud.stream.binder.kafka.default.queueSize=8192

View File

@@ -0,0 +1,2 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration:\
org.springframework.cloud.stream.binder.kafka.config.KafkaServiceAutoConfiguration