【问题标题】:Active MQ Identifying the address of the Queue for ActiveMQActive MQ 识别 ActiveMQ 队列的地址
【发布时间】:2016-05-14 20:25:57
【问题描述】:
@Component
public class OrderItemListener{

    @Autowired
    private final StoreService storeService;

    @JmsListener(destination = "order.item.queue")
    public void receiveOrder(String message) {
        //processing
    }
}

这是我用于接收消息的 POJO 类。我可以通过 JCONSOLE 在此处发送消息,但是,如果我有另一个应用程序需要向此侦听器/队列发送消息怎么办?我将如何识别地址?这是通过 spring-boot 自动配置的。我只指定了activemq jar。

【问题讨论】:

    标签: java spring-boot jms activemq spring-messaging


    【解决方案1】:
    @Autowired
    private JmsTemplate template;
    
    ...
    
    
        this.template.convertAndSend("order.item.queue", "foo");
    

    如果它在不同的 JVM 中运行,您将需要一个独立的代理并设置 spring.activemq.broker-url=tcp://somehost:61616

    【讨论】:

      猜你喜欢
      • 2013-12-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-01
      • 1970-01-01
      • 2015-04-23
      相关资源
      最近更新 更多