无法创建 jms 连接 url 的首选格式

问题描述 投票:0回答:0

我有一个带有以下连接 url

jms:/VirtualTopic.send.email?transport.jms.ConnectionFactory=myTopicConnectionFactory
的 jms 目的地。我无法更改目的地,并且在添加到队列时必须从我这边创建确切的目的地。目前,我已经为下面列出的测试目的开发了一个示例目标侦听器。截至目前,我得到的连接网址为
queue://VirtualTopic.send.email
。 以下是我添加到队列中的实现

    private void sendToJms(String message) {
    try {
        System.out.println("Sending an email message.");
        jmsTemplate.convertAndSend("Virtual.send.email", message);
    } catch (Exception e) {
        System.out.println("--------------- Exception ---------------" + e.getMessage());
    }
}

以下是我为测试目的创建的监听器

@JmsListener(destination = "Virtual.send.email")
private void listener(String message, @Header(JmsHeaders.DESTINATION) String destination) {
   try {
       LOG.info("--------------------- message ----------------------- {}", message);
       LOG.info("--------------------- destination ----------------------- {}", destination);
   } catch (Exception e) {
       LOG.error("Error", e);

   }
}

应用程序.properties

spring.activemq.broker-url=tcp://localhost:61616
spring.activemq.username=admin
spring.activemq.password=secret
spring.activemq.package.trust-all=true

任何人都可以帮我解决这个问题。谢谢

java spring-boot queue jms activemq
© www.soinside.com 2019 - 2024. All rights reserved.