需要示例代码 Spring aws S3 作为 inBound 和 apache kafka 作为出站的集成示例
Need Example code on Spring Integration example for aws S3 as inBound and apache kafka as outbound
需要有关 Spring aws s3 作为入站和 apache kafka 作为出站的集成的示例。
我想从 aws s3 读取数据并需要解析它们并将其生成到 apache kafka 主题
这是一些代码片段。它不起作用,但至少可以从中开始。这里没有人会为您编写代码:
<bean id="s3SessionFactory"
class="org.springframework.integration.aws.support.S3SessionFactory"/>
<int-aws:s3-inbound-channel-adapter channel="s3Channel"
session-factory="s3SessionFactory"
filename-pattern="*.txt"
local-directory="."
remote-directory-expression="'my_bucket'">
<int:poller fixed-rate="1000"/>
</int-aws:s3-inbound-channel-adapter>
<int:transformer input-channel="s3Channel" output-channel="kafkaChannel"
ref="myTransformer"/>
<int-kafka:outbound-channel-adapter
kafka-template="template"
channel="kafkaChannel"
topic="foo"
message-key-expression="'bar'"
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" />
</map>
</constructor-arg>
</bean>
</constructor-arg>
</bean>
需要有关 Spring aws s3 作为入站和 apache kafka 作为出站的集成的示例。
我想从 aws s3 读取数据并需要解析它们并将其生成到 apache kafka 主题
这是一些代码片段。它不起作用,但至少可以从中开始。这里没有人会为您编写代码:
<bean id="s3SessionFactory"
class="org.springframework.integration.aws.support.S3SessionFactory"/>
<int-aws:s3-inbound-channel-adapter channel="s3Channel"
session-factory="s3SessionFactory"
filename-pattern="*.txt"
local-directory="."
remote-directory-expression="'my_bucket'">
<int:poller fixed-rate="1000"/>
</int-aws:s3-inbound-channel-adapter>
<int:transformer input-channel="s3Channel" output-channel="kafkaChannel"
ref="myTransformer"/>
<int-kafka:outbound-channel-adapter
kafka-template="template"
channel="kafkaChannel"
topic="foo"
message-key-expression="'bar'"
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" />
</map>
</constructor-arg>
</bean>
</constructor-arg>
</bean>