我正在尝试设置一个使用嵌入式 JMS 队列的简单 Spring Boot 应用程序。我在 HornetQ 上很成功,但是当我尝试转换为 Artemis 时,我在 ArtemisConnectionFactory 上遇到了失败。这是我用于 HornetQ 的代码。任何帮助将不胜感激。
package com.comporium.log.server;
import javax.jms.ConnectionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;
import org.springframework.jms.listener.DefaultMessageListenerContainer;
import com.comporium.log.server.services.LogListener;
@SpringBootApplication
public class Application {
@Autowired
private ConnectionFactory connectionFactory;
@Autowired
LogListener logListener;
@Bean
public DefaultMessageListenerContainer messageListener() {
DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();
container.setConnectionFactory(this.connectionFactory);
container.setDestinationName("loggerQueue");
container.setMessageListener(logListener);
return container;
}
public static void main(String[] args) throws Exception {
SpringApplication.run(Application.class, args);
}
}