Spring integration 如何使用spring从kafka入站消息中提取数据
我正在用spring构建一个卡夫卡消费者。我的配置似乎非常简单。正在使用邮件并将其保存在文件中。然而,有效载荷是神秘的,我无法获取数据(简短的“hello world”消息) 这是我访问有效负载时得到的结果(例如,当我在入站kafka和outboud文件中设置transformer bean btween时:Spring integration 如何使用spring从kafka入站消息中提取数据,spring-integration,apache-kafka,Spring Integration,Apache Kafka,我正在用spring构建一个卡夫卡消费者。我的配置似乎非常简单。正在使用邮件并将其保存在文件中。然而,有效载荷是神秘的,我无法获取数据(简短的“hello world”消息) 这是我访问有效负载时得到的结果(例如,当我在入站kafka和outboud文件中设置transformer bean btween时: {test-topic={0=[[B@713c9d72, [B@7d656f90, [B@26bb8c83, [B@4b959d83 [B@5ed74e8e]}} 我的问题是:如何访问实
{test-topic={0=[[B@713c9d72, [B@7d656f90, [B@26bb8c83, [B@4b959d83 [B@5ed74e8e]}}
我的问题是:如何访问实际有效负载(“hellow world”字符串)
我的配置是:
<int:channel id="inputFromKafka">
<int:queue />
</int:channel>
<int:poller
max-messages-per-poll="5" default = "true" fixed-delay="10" time-unit="MILLISECONDS"/>
<int-kafka:inbound-channel-adapter
id="kafkaInboundChannelAdapter" kafka-consumer-context-ref="consumerContext"
auto-startup="true" channel="inputFromKafka">
<int-kafka:consumer-context id="consumerContext"
consumer-timeout="40000" zookeeper-connect="zookeeperConnect">
<int-kafka:consumer-configurations>
<int-kafka:consumer-configuration
group-id="group12" max-messages="5">
<int-kafka:topic id="test-topic" streams="1" />
</int-kafka:consumer-configuration>
</int-kafka:consumer-configurations>
</int-kafka:consumer-context>
<int-kafka:zookeeper-connect id="zookeeperConnect"
zk-connect="localhost:2181" zk-connection-timeout="6000"
zk-session-timeout="6000" zk-sync-time="2000" />
<file:outbound-channel-adapter id="filesOut"
directory="/tmp/fromKafka">
</file:outbound-channel-adapter>
您看到的是原始的
字节[]
加上
<bean id="decoder"
class="org.springframework.integration.kafka.serializer.common.StringDecoder" />
及
您看到的是原始的字节[]
加上
<bean id="decoder"
class="org.springframework.integration.kafka.serializer.common.StringDecoder" />
及