java - springrabbit是否需要声明队列来发送消息

标签 java spring rabbitmq

我需要将消息发送到名为“myQueue”的队列到 MQ 服务器。我应该在 Spring 声明所有必需的bean,例如队列等吗?在我看来,这没什么用,因为我只需要发送到服务器,并在可能的情况下接收,我不会监听队列,是否可以将其扔在那里然后忘记,而无需任何显式配置?

最佳答案

I need to send a message to a queue with name "myQueue" to the MQ server. 
Should I declare all required beans in spring, like Queue and etc for it.

没有。如果不声明连接工厂、交换和队列等 bean,您就无法将消息发布到队列。

It seems to me useless because I only need to send to server, and receive if possible, 
I`m not going to listen the queue, is it possible just to throw it there and forget, without any explicit configuration?

Spring 并不是 super 自然,尽管无论您是否消费消息,如果您想将消息推送到队列,Spring 都应该知道连接和队列详细信息。

您可以引用my blog post有关 spring-rabbit 编程的更多详细信息。

关于java - springrabbit是否需要声明队列来发送消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29842165/

相关文章:

java - 为什么 Tomcat 提示试图向响应 header 写入太多内容?

spring - TestNG 和 Spring AOP

angularjs - IE 在使用 NTLM 身份验证时随机发送空 POST 正文(使用 Angular 到 Spring)

java - 不正确的week_of_year

java - Elasticsearch Rest 客户端更新操作

java - 无法使用 Spring Boot 在 RabbitMQ 中返回消息

node.js - 如何停止rabbitmq服务器

rabbitmq - 队列公平性和消息服务器

java - Tomcat进程阻止其他进程重新绑定(bind)到porton重启

java - 如何在 Spring 中向多个收件人发送电子邮件