我需要当前易于遵循的说明,以从XML配置Spring Integration Kafka [英] I need current easy to follow instructions for configuring spring integration kafka from XML
问题描述
spring集成kafka模型已经进行了充分的更改,并且已经进行了改进,并简化了现有的演示,手册和说明不再起作用.当前的官方演示都是围绕注解构建的,这些注解很酷,但是基本上不可读,不适用于我的体系结构,在该体系结构中,作业是与Java代码分开部署和管理的.
The spring integration kafka model has changed sufficiently as it has been worked on and simplified that the extant demos, manuals, and instructions don't work any more. The current official demos are all built around annotations, which are cool, but largely unreadable, and are not appropriate for my architecture in which the jobs are deployed and managed separately from the java code.
是否存在 最新 (2019)教程,用于在 XML 中配置spring集成的生产者和消费者?
Is there a current (2019) tutorial for configuring, in XML, spring integrations producers and consumers?
作为参考,以下是我的POM的摘录,其中详细介绍了我使用的版本:
For reference, here is an extract from my POM that details the versions I am using:
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
<version>5.1.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-kafka</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-file</artifactId>
<version>5.1.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-core</artifactId>
<version>4.1.1.RELEASE</version>
</dependency>
不赞成投票的人
根据加里·罗素(Gary Russel)在其回答中的评论,github上的链接已断开,现已修复.
The link on github was broken and is now fixed, per comment by Gary Russel in his answer
推荐答案
Does the reference manual not provide what you need?
例如:
<int-kafka:outbound-channel-adapter id="kafkaOutboundChannelAdapter"
kafka-template="template"
auto-startup="false"
channel="inputToKafka"
topic="foo"
sync="false"
message-key-expression="'bar'"
send-failure-channel="failures"
send-success-channel="successes"
error-message-strategy="ems"
partition-id-expression="2">
</int-kafka:outbound-channel-adapter>
<bean id="template" class="org.springframework.kafka.core.KafkaTemplate">
<constructor-arg>
<bean class="org.springframework.kafka.core.DefaultKafkaProducerFactory">
<constructor-arg>
<map>
<entry key="bootstrap.servers" value="localhost:9092" />
... <!-- more producer properties -->
</map>
</constructor-arg>
</bean>
</constructor-arg>
</bean>
和
<int-kafka:message-driven-channel-adapter
id="kafkaListener"
listener-container="container1"
auto-startup="false"
phase="100"
send-timeout="5000"
mode="record"
retry-template="template"
recovery-callback="callback"
error-message-strategy="ems"
channel="someChannel"
error-channel="errorChannel" />
<bean id="container1" class="org.springframework.kafka.listener.KafkaMessageListenerContainer">
<constructor-arg>
<bean class="org.springframework.kafka.core.DefaultKafkaConsumerFactory">
<constructor-arg>
<map>
<entry key="bootstrap.servers" value="localhost:9092" />
...
</map>
</constructor-arg>
</bean>
</constructor-arg>
<constructor-arg>
<bean class="org.springframework.kafka.listener.config.ContainerProperties">
<constructor-arg name="topics" value="foo" />
</bean>
</constructor-arg>
</bean>
等...
这篇关于我需要当前易于遵循的说明,以从XML配置Spring Integration Kafka的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!