spring-boot - Artemis 的生产者问题
问题描述
您好,我正在尝试将消息生成到我的服务器中上传的队列中,并且我正在使用 spring-boot-starter-artemis。当我从服务器端发送消息时,我的消费者没有任何问题,我的应用程序可以使用它。但是在尝试生成时,我得到了这个异常:javax.jms.JMSException: There is no queue with name myqueueName
@Component
public class ArtemisProducer {
@Autowired
JmsTemplate jmsTemplate;
@Value("${jms.queue.destination}")
String destinationQueue;
public void send(String msg){
jmsTemplate.convertAndSend(destinationQueue, msg);
}
}
配置文件:
spring.artemis.mode=native
spring.artemis.host=host
spring.artemis.port=port
spring.artemis.user=username
spring.artemis.password=password
jms.queue.destination=myqueue
例外 :
"exception": "org.springframework.jms.UncategorizedJmsException",
"message": "Uncategorized exception occurred during JMS processing; nested exception is javax.jms.JMSException: There is no queue with name myqueue",
解决方案
默认情况下,地址和队列都是自动创建的。听起来您的经纪人已禁用此功能。您应该使用以下地址设置启用自动地址和队列创建:
<auto-create-queues>true</auto-create-queues>
<auto-create-addresses>true</auto-create-addresses>
或者手动创建地址和队列,例如:
<addresses>
<address name="myqueue">
<anycast>
<queue name="myqueue"/>
</anycast>
</address>
</addresses>
推荐阅读
- python - 如何在用户注册 Django 时添加新的数据库条目?
- testing - 将值传递给 mocha 中的其他测试用例
- node.js - 节点和反应应用程序与 nginx 连接问题
- python - Python Plotly:百分比轴格式化程序
- excel - 在 Excel 中选择数据作为某些单元格之间的组,然后将每个单元格除以组值以查找百分比
- batch-file - 如何在所有子文件夹中单独压缩所有文件并在之后删除原始文件
- javascript - Leaflet 中的 geoJSON:显示与列表中的值匹配的特征
- c# - asp.net Core Razor CRUD - 不会接受任何有效的电话输入
- tensorflow - 如何按名称加载 keras-tuner 项目?
- c++ - 如何知道 C++ 中模板参数所需的接口/契约?