简体   繁体   English

RabbitMq 在 Spring 引导微服务中看不到队列并且无法将消息从一个服务发送到另一个服务

[英]RabbitMq Cannot see queue and Cannot send message from one service to another in Spring Boot Microservices

I have a problem about sending message from advertisement service to report service through RabbitMq .我在通过RabbitMq广告服务报告服务发送消息时遇到问题。

I run the rabbitmq through docker .我通过docker 运行 rabbitmq Here is the code shown below.这是下面显示的代码。

rabbitmq:
    image: "rabbitmq:3-management"
    container_name: "rmq3"
    environment:
      RABBITMQ_DEFAULT_USER: "rabbitmq"
      RABBITMQ_DEFAULT_PASS: "123456"
    ports:
      - "5672:5672"
      - "15672:15672"

When I tried to get message from rabbitTemplate.convertAndSend in advertisement service .当我尝试从广告服务中的rabbitTemplate.convertAndSend获取消息时。 I got an error in report service .我在报告服务中遇到错误

Here is the error shown below.这是下面显示的错误。

Caused by: org.springframework.messaging.converter.MessageConversionException: Cannot convert from [[B] to [com.springbootmicroservices.report.dto.AdvertisementDto] for GenericMessage [payload=byte[59], headers={amqp_receivedDeliveryMode=PERSISTENT, amqp_receivedRoutingKey=queue-advertisement, amqp_contentEncoding=UTF-8, amqp_deliveryTag=1, amqp_consumerQueue=queue-advertisement, amqp_redelivered=false, id=38ab4c7f-6de4-dbbd-6471-5ba1cf2a80bc, amqp_consumerTag=amq.ctag-d4XUFeupnFO59f5OKRwlTQ, amqp_lastInBatch=false, contentType=application/json, __TypeId__=com.springbootmicroservices.advertisement.dto.AdvertisementDto, timestamp=1659551606120}]

How can I fix the issue?我该如何解决这个问题?

Here is my project link: Link这是我的项目链接:链接

After I defined both this bean in advertisement and report service, the issue disappeared.在我在广告和报告服务中定义了这个 bean 之后,问题就消失了。

Here is the bean这里是豆

@Bean
public MessageConverter jsonMessageConverter(ObjectMapper objectMapper) {
   return new Jackson2JsonMessageConverter(objectMapper);
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Spring 启动 websocket RabbitMQ STOMP 中继代理无法从没有 ZB136EF5F37A01D8163Z 连接的实例发送到客户端时发送消息 - Spring Boot websocket RabbitMQ STOMP relay broker cannot send message when sent from instance without TCP connection to client 无法从 Spring Boot 连接到 rabbitmq STOMP - Cannot connect to rabbitmq STOMP from Spring boot spring boot 无法连接rabbitmq - spring boot cannot connect to rabbitmq 使用 rabbitmq 将字符串/自定义对象从一个 Spring Boot 应用程序发送到另一个 - Using rabbitmq to send String/Custom Object from one spring boot application to another 使用@SentTo通过Spring Boot和RabbitMq发送消息 - Use @SentTo to send a message with Spring Boot and RabbitMq Spring boot,apache camel和hawtio:无法向端点发送消息 - Spring boot , apache camel and hawtio: cannot send message to endpoint 使用 Spring 引导向 JMS 队列发送消息 - Send message to a JMS queue using Spring Boot 如何使用rabbitmq docker从spring-boot在rabbitmq中创建队列 - How to create queue in rabbitmq from spring-boot with rabbitmq docker 在Springboot微服务api中,如何使用AMQP队列调用另一个服务器,如何从另一个服务队列获取响应,发送响应 - In Springboot microservices api, how to call a another server using AMQP queue, get response from the another service queue, send the response Spring Boot - 使用 RabbitMQ 发送消息以连续监听消息队列 - Spring boot - Messaging with RabbitMQ to listen message queue continuously
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM