Apache kafka 为什么Camel Kafka Rabbitmq连接器将我的消息转换为不可读的格式?

Apache kafka 为什么Camel Kafka Rabbitmq连接器将我的消息转换为不可读的格式?,apache-kafka,rabbitmq,apache-camel,apache-kafka-connect,Apache Kafka,Rabbitmq,Apache Camel,Apache Kafka Connect,我的目标是在rabbitmq交换队列和kafka主题之间设置一个连接器 我按照此指南设置连接器:。我从源代码下载并安装了连接器,为camel-rabbitmq-kafka连接器构建并解压缩了文件。我还将plugin.path指向我在connect-standalone.properties中解压camel-rabbitmq-kafka连接器的文件夹 我用于CamelRabbitSourceConnector的参数如下: name=CamelRabbitmqSourceConnector conn

我的目标是在rabbitmq交换队列和kafka主题之间设置一个连接器

我按照此指南设置连接器:。我从源代码下载并安装了连接器,为
camel-rabbitmq-kafka连接器构建并解压缩了文件。我还将
plugin.path
指向我在connect-standalone.properties中解压
camel-rabbitmq-kafka连接器的文件夹

我用于
CamelRabbitSourceConnector
的参数如下:

name=CamelRabbitmqSourceConnector
connector.class=org.apache.camel.kafkaconnector.rabbitmq.CamelRabbitmqSourceConnector
tasks.max=1

# use the kafka converters that better suit your needs, these are just defaults:
key.converter=org.apache.kafka.connect.storage.StringConverter
value.converter=org.apache.kafka.connect.storage.StringConverter

# comma separated topics to send messages into
topics=mytopic

# mandatory properties (for a complete properties list see the connector documentation):

# The exchange name determines the exchange to which the produced messages will be sent to. In the case of consumers, the exchange name determines the exchange the queue will be bound to.
camel.source.path.exchangeName=myexchange
camel.source.endpoint.hostname=myhostname
camel.source.endpoint.addresses=localhost:5672
camel.source.endpoint.queue=myqueue
rabbitmq的docker运行命令如下所示:
docker-run-rm-it-hostname-myhostname-p 15672:15672-name rabbitmq rabbitmq:3-management
。对于卡夫卡,我使用了标准的“入门”指南

使用python Pika库发送消息:

import pika
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
channel = connection.channel()
channel.queue_declare(queue='myqueue',durable=True,auto_delete=True)
channel.basic_publish(exchange='', routing_key='myqueue', body='some body...')

如您所见,我发送消息时未在
频道中指定
交换
参数。基本发布
功能。如果我将其设置为camel.source.path.exchangeName
,则我的消息会在两者之间的某个地方丢失,因此,我可能遗漏了一些东西。

我可以通过将客户端更改为Java:而不是python:来解决问题。

我可以通过将客户端更改为Java:而不是python:来解决问题。

我可以使用以下属性使其正常工作:

name=CamelRabbitmqSourceConnector
connector.class=org.apache.camel.kafkaconnector.rabbitmq.CamelRabbitmqSourceConnector
tasks.max=1

# use the kafka converters that better suit your needs, these are just defaults:
key.converter=org.apache.kafka.connect.storage.StringConverter
value.converter=org.apache.kafka.connect.storage.StringConverter

# comma separated topics to send messages into
topics=mytopic

# mandatory properties (for a complete properties list see the connector documentation):

# The exchange name determines the exchange to which the produced messages will be sent to. In the case of consumers, the exchange name determines the exchange the queue will be bound to.
camel.source.endpoint.hostname=myhostname
camel.source.endpoint.addresses=localhost:5672
camel.source.endpoint.queue=myqueue
camel.source.endpoint.autoDelete=false
camel.source.endpoint.skipExchangeDeclare=true
camel.source.endpoint.skipQueueBind=true

我能够使用以下属性使其工作:

name=CamelRabbitmqSourceConnector
connector.class=org.apache.camel.kafkaconnector.rabbitmq.CamelRabbitmqSourceConnector
tasks.max=1

# use the kafka converters that better suit your needs, these are just defaults:
key.converter=org.apache.kafka.connect.storage.StringConverter
value.converter=org.apache.kafka.connect.storage.StringConverter

# comma separated topics to send messages into
topics=mytopic

# mandatory properties (for a complete properties list see the connector documentation):

# The exchange name determines the exchange to which the produced messages will be sent to. In the case of consumers, the exchange name determines the exchange the queue will be bound to.
camel.source.endpoint.hostname=myhostname
camel.source.endpoint.addresses=localhost:5672
camel.source.endpoint.queue=myqueue
camel.source.endpoint.autoDelete=false
camel.source.endpoint.skipExchangeDeclare=true
camel.source.endpoint.skipQueueBind=true

您是否尝试在RabbitMQ中将
myqueue
显式绑定到
myexchange
?我不知道如何显式绑定它们。但是看一下管理控制台,我发现
myexchange
是一种
直接的
类型,路由键与队列名称匹配,队列名称是
myqueue
。您是否尝试在RabbitMQ中将
myqueue
显式绑定到
myexchange
?我不知道如何显式绑定它们。但是看一下管理控制台,我发现
myexchange
是一种
direct
类型,路由键与队列名称匹配,队列名称是
myqueue
;您能提供完整的可运行python源代码吗?我粘贴了python客户端的完整示例。我从与Java相同的指南中获得了它:理解python的不同之处仍然是很有趣的;您能提供完整的可运行python源代码吗?我粘贴了python客户端的完整示例。我从与Java相同的指南中获取: