gpt4 book ai didi

apache-camel - Camel RabbitMQ + convertSendAndReceive(): Could not convert incoming message with content-type [null]

转载 作者:行者123 更新时间:2023-12-04 17:08:47 24 4
gpt4 key购买 nike

我有一个组件,它向工作人员服务发送一条消息,等待结果返回。

@Autowired
private RabbitTemplate rabbit;
[...]
Object response = rabbit.convertSendAndReceive("testQ", ...);

worker 服务是通过Apache Camel rabbitmq路由实现的:
from("rabbitmq://localhost/myExchange?declare=false&routingKey=testQ&queue=testQ")
.routeId("myCamelRoute")
.process(myProcessor)
.to("log:myLog");

myProcessor处理该消息并注销Camel消息头:
__TypeId__=...
breadcrumbId=...
rabbitmq.CONTENT_ENCODING=UTF-8
rabbitmq.CONTENT_TYPE=application/json
rabbitmq.CORRELATIONID=7e390b6b-d30f-4f26-ba44-33fb887db0e8
rabbitmq.DELIVERY_TAG=4
rabbitmq.EXCHANGE_NAME=
rabbitmq.PRIORITY=0
rabbitmq.REPLY_TO=amq.rabbitmq.reply-to.g2dkABNyYWJiaXRAOWU5ZjkxNDI4ZWRiAAAJgwAAADUC.5+kPXXxaXhoYo7A4T0HSZQ==
rabbitmq.ROUTING_KEY=testQ

消息头显然在工作端包含 rabbitmq.CONTENT_TYPE = application/json ,但是当响应消息返回时,此信息似乎“丢失”:

o.s.a.s.c.Jackson2JsonMessageConverter : Could not convert incoming message with content-type [null]



知道这里有什么问题吗?

最佳答案

使用Headers字段时,使用RabbitMQ管理控制台遇到了相同的错误。
传递“content_type”:“application/json”作为消息属性工作正常。

关于apache-camel - Camel RabbitMQ + convertSendAndReceive(): Could not convert incoming message with content-type [null],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30736670/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com