我没有看到从 Spring Boot 发送到 ActiveMQ Artemis 的消息 JMS 队列
我正在开发向 ActiveMQ Artemis 版本 2.16.0 发送消息。所以我做了一个概念测试。当消息从 Spring 发送时,一切正常,但是当我尝试在生产者部分的 ActiveMQ Artemis 中搜索消息时,我没有看到任何消息。
@RestController
public class RestApiController {
@Autowired
ArtemisProducer producer;
@RequestMapping(value="/produce")
public String produce(@RequestParam("msg")String msg){
producer.send(msg);
return "Done";
}
@RequestMapping(value="/produce",method = RequestMethod.POST)
public String produce(@RequestBody Person p){
producer.send(p);
return "Send Person Done" + p.toString();
}
}
@Component
@EnableJms
public class ArtemisProducer {
@Autowired
JmsTemplate jmsTemplate;
@Value("${jms.queue.destination}")
String destinationQueue;
public void send(String msg){
jmsTemplate.convertAndSend(destinationQueue, msg);
}
public void send(Person p){
jmsTemplate.convertAndSend(destinationQueue, p);
}
}
application.properties
:
spring.artemis.mode=native
spring.artemis.host=localhost
spring.artemis.port=61616
spring.artemis.user=myuser
spring.artemis.password=otherpassword
jms.queue.destination=activemq.artemis-0526a0b16204:DLQ
我也尝试使用jms.queue.destination=DLQ
,但行为是相同的。
I am doing a development to send a message to ActiveMQ Artemis Version 2.16.0. So I did a concept test. When the message is sent from Spring all works well, but when I try search the message in ActiveMQ Artemis in the producer section I don't see neither message.
@RestController
public class RestApiController {
@Autowired
ArtemisProducer producer;
@RequestMapping(value="/produce")
public String produce(@RequestParam("msg")String msg){
producer.send(msg);
return "Done";
}
@RequestMapping(value="/produce",method = RequestMethod.POST)
public String produce(@RequestBody Person p){
producer.send(p);
return "Send Person Done" + p.toString();
}
}
@Component
@EnableJms
public class ArtemisProducer {
@Autowired
JmsTemplate jmsTemplate;
@Value("${jms.queue.destination}")
String destinationQueue;
public void send(String msg){
jmsTemplate.convertAndSend(destinationQueue, msg);
}
public void send(Person p){
jmsTemplate.convertAndSend(destinationQueue, p);
}
}
application.properties
:
spring.artemis.mode=native
spring.artemis.host=localhost
spring.artemis.port=61616
spring.artemis.user=myuser
spring.artemis.password=otherpassword
jms.queue.destination=activemq.artemis-0526a0b16204:DLQ
I also tried using jms.queue.destination=DLQ
, but the behavior was the same.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论