企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 32.1.2 Artemis支持 Apache Artemis成立于2015年,那时HornetQ刚捐给Apache基金会,确保别使用了过期的HornetQ支持。 **注** 不要尝试同时使用Artemis和HornetQ。 如果发现classpath下存在Artemis依赖,Spring Boot将自动配置一个`ConnectionFactory`。如果需要broker,Spring Boot将启动内嵌的broker,并对其自动配置(除非模式mode属性被显式设置)。支持的modes包括:`embedded`(明确需要内嵌broker,如果classpath下不存在则出错),`native`(使用`netty`传输协议连接broker)。当配置`native`模式,Spring Boot将配置一个连接broker的`ConnectionFactory`,该broker使用默认的设置运行在本地机器。 **注** 使用`spring-boot-starter-artemis` 'Starter',则连接已存在的Artemis实例及Spring设施集成JMS所需依赖都会提供,添加`org.apache.activemq:artemis-jms-server`依赖,你可以使用内嵌模式。 Artemis配置控制在外部配置属性`spring.artemis.*`中,例如,在`application.properties`声明以下片段: ```text spring.artemis.mode=native spring.artemis.host=192.168.1.210 spring.artemis.port=9876 spring.artemis.user=admin spring.artemis.password=secret ``` 当使用内嵌模式时,你可以选择是否启用持久化,及目的地列表。这些可以通过逗号分割的列表来指定,也可以分别定义`org.apache.activemq.artemis.jms.server.config.JMSQueueConfiguration`或`org.apache.activemq.artemis.jms.server.config.TopicConfiguration`类型的bean来进一步配置队列和topic,具体支持选项可参考[ArtemisProperties](https://github.com/spring-projects/spring-boot/tree/v1.4.1.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisProperties.java)。