diff --git a/pom.xml b/pom.xml index ad85bc212..be5fa127a 100644 --- a/pom.xml +++ b/pom.xml @@ -83,6 +83,11 @@ spring-cloud-stream-binder-rabbit ${project.version} + + org.springframework.cloud + spring-cloud-stream-binder-kafka + ${project.version} + org.springframework.cloud spring-cloud-stream-binder-test diff --git a/spring-cloud-stream-binders/spring-cloud-stream-binder-kafka/pom.xml b/spring-cloud-stream-binders/spring-cloud-stream-binder-kafka/pom.xml index 7bd249669..8a28b1788 100644 --- a/spring-cloud-stream-binders/spring-cloud-stream-binder-kafka/pom.xml +++ b/spring-cloud-stream-binders/spring-cloud-stream-binder-kafka/pom.xml @@ -43,6 +43,7 @@ org.springframework.cloud spring-cloud-stream-binder-test + test org.springframework.integration diff --git a/spring-cloud-stream-binders/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/config/KafkaServiceAutoConfiguration.java b/spring-cloud-stream-binders/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/config/KafkaServiceAutoConfiguration.java new file mode 100644 index 000000000..c63cd6d18 --- /dev/null +++ b/spring-cloud-stream-binders/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/config/KafkaServiceAutoConfiguration.java @@ -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 { +} diff --git a/spring-cloud-stream-binders/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/package-info.java b/spring-cloud-stream-binders/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/package-info.java new file mode 100644 index 000000000..fb1989df7 --- /dev/null +++ b/spring-cloud-stream-binders/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/package-info.java @@ -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; diff --git a/spring-cloud-stream-binders/spring-cloud-stream-binder-kafka/src/main/resources/META-INF/spring-cloud-stream/kafka-binder.properties b/spring-cloud-stream-binders/spring-cloud-stream-binder-kafka/src/main/resources/META-INF/spring-cloud-stream/kafka-binder.properties new file mode 100644 index 000000000..bf7b84ff5 --- /dev/null +++ b/spring-cloud-stream-binders/spring-cloud-stream-binder-kafka/src/main/resources/META-INF/spring-cloud-stream/kafka-binder.properties @@ -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 diff --git a/spring-cloud-stream-binders/spring-cloud-stream-binder-kafka/src/main/resources/META-INF/spring.factories b/spring-cloud-stream-binders/spring-cloud-stream-binder-kafka/src/main/resources/META-INF/spring.factories new file mode 100644 index 000000000..7f00520be --- /dev/null +++ b/spring-cloud-stream-binders/spring-cloud-stream-binder-kafka/src/main/resources/META-INF/spring.factories @@ -0,0 +1,2 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration:\ +org.springframework.cloud.stream.binder.kafka.config.KafkaServiceAutoConfiguration