Skip to content

Commit c5afd85

Browse files
committed
Create spring-boot-activemq module
1 parent d12bf15 commit c5afd85

File tree

34 files changed

+171
-133
lines changed

34 files changed

+171
-133
lines changed

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ settings.gradle.projectsLoaded {
3838
}
3939

4040
include "spring-boot-project:spring-boot"
41+
include "spring-boot-project:spring-boot-activemq"
4142
include "spring-boot-project:spring-boot-actuator"
4243
include "spring-boot-project:spring-boot-actuator-autoconfigure"
4344
include "spring-boot-project:spring-boot-all"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
plugins {
2+
id "java-library"
3+
id "org.springframework.boot.auto-configuration"
4+
id "org.springframework.boot.configuration-properties"
5+
id "org.springframework.boot.deployed"
6+
id "org.springframework.boot.optional-dependencies"
7+
}
8+
9+
description = "Spring Boot ActiveMQ"
10+
11+
dependencies {
12+
api(project(":spring-boot-project:spring-boot-jms"))
13+
api("org.apache.activemq:activemq-client")
14+
15+
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
16+
optional("jakarta.transaction:jakarta.transaction-api")
17+
optional("org.apache.activemq:activemq-broker")
18+
optional("org.messaginghub:pooled-jms") {
19+
exclude group: "org.apache.geronimo.specs", module: "geronimo-jms_2.0_spec"
20+
}
21+
22+
testImplementation(project(":spring-boot-project:spring-boot-test"))
23+
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
24+
testImplementation("org.assertj:assertj-core")
25+
testImplementation("org.awaitility:awaitility")
26+
testImplementation("org.junit.jupiter:junit-jupiter")
27+
testImplementation("org.mockito:mockito-core")
28+
testImplementation("org.mockito:mockito-junit-jupiter")
29+
30+
testRuntimeOnly("ch.qos.logback:logback-classic")
31+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.jms.activemq;
17+
package org.springframework.boot.activemq.autoconfigure;
1818

1919
import jakarta.jms.ConnectionFactory;
2020
import org.apache.activemq.ActiveMQConnectionFactory;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.jms.activemq;
17+
package org.springframework.boot.activemq.autoconfigure;
1818

1919
import org.springframework.boot.autoconfigure.service.connection.ConnectionDetails;
2020

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.jms.activemq;
17+
package org.springframework.boot.activemq.autoconfigure;
1818

1919
import jakarta.jms.ConnectionFactory;
2020
import org.apache.activemq.ActiveMQConnectionFactory;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.jms.activemq;
17+
package org.springframework.boot.activemq.autoconfigure;
1818

1919
import java.util.Collections;
2020
import java.util.List;
2121

2222
import org.apache.activemq.ActiveMQConnectionFactory;
2323

24-
import org.springframework.boot.autoconfigure.jms.activemq.ActiveMQProperties.Packages;
24+
import org.springframework.boot.activemq.autoconfigure.ActiveMQProperties.Packages;
2525
import org.springframework.util.Assert;
2626

2727
/**
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.jms.activemq;
17+
package org.springframework.boot.activemq.autoconfigure;
1818

1919
import org.apache.activemq.ActiveMQConnectionFactory;
2020

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.jms.activemq;
17+
package org.springframework.boot.activemq.autoconfigure;
1818

1919
import java.time.Duration;
2020
import java.util.ArrayList;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.jms.activemq;
17+
package org.springframework.boot.activemq.autoconfigure;
1818

1919
import jakarta.jms.ConnectionFactory;
2020
import jakarta.transaction.TransactionManager;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
/**
1818
* Auto-configuration for ActiveMQ.
1919
*/
20-
package org.springframework.boot.autoconfigure.jms.activemq;
20+
package org.springframework.boot.activemq.autoconfigure;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
{
2+
"groups": [],
3+
"properties": [
4+
{
5+
"name": "spring.activemq.pool.block-if-full",
6+
"type": "java.lang.Boolean",
7+
"description": "Whether to block when a connection is requested and the pool is full. Set it to false to throw a \"JMSException\" instead.",
8+
"sourceType": "org.springframework.boot.jms.autoconfigure.JmsPoolConnectionFactoryProperties",
9+
"defaultValue": true
10+
},
11+
{
12+
"name": "spring.activemq.pool.block-if-full-timeout",
13+
"type": "java.time.Duration",
14+
"description": "Blocking period before throwing an exception if the pool is still full.",
15+
"sourceType": "org.springframework.boot.jms.autoconfigure.JmsPoolConnectionFactoryProperties",
16+
"defaultValue": "-1ms"
17+
},
18+
{
19+
"name": "spring.activemq.pool.create-connection-on-startup",
20+
"type": "java.lang.Boolean",
21+
"description": "Whether to create a connection on startup. Can be used to warm up the pool on startup.",
22+
"defaultValue": true,
23+
"deprecation": {
24+
"level": "error"
25+
}
26+
},
27+
{
28+
"name": "spring.activemq.pool.enabled",
29+
"type": "java.lang.Boolean",
30+
"description": "Whether a JmsPoolConnectionFactory should be created, instead of a regular ConnectionFactory.",
31+
"sourceType": "org.springframework.boot.jms.autoconfigure.JmsPoolConnectionFactoryProperties",
32+
"defaultValue": false
33+
},
34+
{
35+
"name": "spring.activemq.pool.expiry-timeout",
36+
"type": "java.time.Duration",
37+
"description": "Connection expiration timeout.",
38+
"defaultValue": "0ms",
39+
"deprecation": {
40+
"level": "error"
41+
}
42+
},
43+
{
44+
"name": "spring.activemq.pool.idle-timeout",
45+
"type": "java.time.Duration",
46+
"description": "Connection idle timeout.",
47+
"sourceType": "org.springframework.boot.jms.autoconfigure.JmsPoolConnectionFactoryProperties",
48+
"defaultValue": "30s"
49+
},
50+
{
51+
"name": "spring.activemq.pool.max-connections",
52+
"type": "java.lang.Integer",
53+
"description": "Maximum number of pooled connections.",
54+
"sourceType": "org.springframework.boot.jms.autoconfigure.JmsPoolConnectionFactoryProperties",
55+
"defaultValue": 1
56+
},
57+
{
58+
"name": "spring.activemq.pool.max-sessions-per-connection",
59+
"type": "java.lang.Integer",
60+
"description": "Maximum number of pooled sessions per connection in the pool.",
61+
"sourceType": "org.springframework.boot.jms.autoconfigure.JmsPoolConnectionFactoryProperties",
62+
"defaultValue": 500
63+
},
64+
{
65+
"name": "spring.activemq.pool.maximum-active-session-per-connection",
66+
"deprecation": {
67+
"replacement": "spring.activemq.pool.max-sessions-per-connection"
68+
}
69+
},
70+
{
71+
"name": "spring.activemq.pool.reconnect-on-exception",
72+
"type": "java.lang.Boolean",
73+
"description": "Reset the connection when a \"JMSException\" occurs.",
74+
"defaultValue": true,
75+
"deprecation": {
76+
"level": "error"
77+
}
78+
},
79+
{
80+
"name": "spring.activemq.pool.time-between-expiration-check",
81+
"type": "java.time.Duration",
82+
"description": "Time to sleep between runs of the idle connection eviction thread. When negative, no idle connection eviction thread runs.",
83+
"sourceType": "org.springframework.boot.jms.autoconfigure.JmsPoolConnectionFactoryProperties",
84+
"defaultValue": "-1ms"
85+
},
86+
{
87+
"name": "spring.activemq.pool.use-anonymous-producers",
88+
"type": "java.lang.Boolean",
89+
"description": "Whether to use only one anonymous \"MessageProducer\" instance. Set it to false to create one \"MessageProducer\" every time one is required.",
90+
"sourceType": "org.springframework.boot.jms.autoconfigure.JmsPoolConnectionFactoryProperties",
91+
"defaultValue": true
92+
}
93+
]
94+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.springframework.boot.activemq.autoconfigure.ActiveMQAutoConfiguration
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.jms.activemq;
17+
package org.springframework.boot.activemq.autoconfigure;
1818

1919
import jakarta.jms.ConnectionFactory;
2020
import org.apache.activemq.ActiveMQConnectionFactory;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.jms.activemq;
17+
package org.springframework.boot.activemq.autoconfigure;
1818

1919
import org.apache.activemq.ActiveMQConnectionFactory;
2020
import org.junit.jupiter.api.Test;

spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ dependencies {
1717
implementation("com.fasterxml.jackson.core:jackson-databind")
1818
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
1919

20+
optional(project(":spring-boot-project:spring-boot-activemq"))
2021
optional(project(":spring-boot-project:spring-boot-amqp"))
2122
optional(project(":spring-boot-project:spring-boot-jackson"))
2223
optional(project(":spring-boot-project:spring-boot-jetty"))
23-
optional(project(":spring-boot-project:spring-boot-jms"))
2424
optional(project(":spring-boot-project:spring-boot-jsonb"))
2525
optional(project(":spring-boot-project:spring-boot-mail"))
2626
optional(project(":spring-boot-project:spring-boot-reactor-netty"))

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/jms/JmsHealthContributorAutoConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
2929
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
3030
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
31-
import org.springframework.boot.autoconfigure.jms.activemq.ActiveMQAutoConfiguration;
3231
import org.springframework.boot.autoconfigure.jms.artemis.ArtemisAutoConfiguration;
3332
import org.springframework.context.annotation.Bean;
3433

@@ -38,7 +37,8 @@
3837
* @author Stephane Nicoll
3938
* @since 2.0.0
4039
*/
41-
@AutoConfiguration(after = { ActiveMQAutoConfiguration.class, ArtemisAutoConfiguration.class })
40+
@AutoConfiguration(after = ArtemisAutoConfiguration.class,
41+
afterName = "org.springframework.boot.activemq.autoconfigure.ActiveMQAutoConfiguration")
4242
@ConditionalOnClass(ConnectionFactory.class)
4343
@ConditionalOnBean(ConnectionFactory.class)
4444
@ConditionalOnEnabledHealthIndicator("jms")

spring-boot-project/spring-boot-actuator/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ dependencies {
2323
dockerTestImplementation("org.testcontainers:neo4j")
2424
dockerTestImplementation("org.testcontainers:testcontainers")
2525

26+
optional(project(":spring-boot-project:spring-boot-activemq"))
2627
optional(project(":spring-boot-project:spring-boot-jetty"))
27-
optional(project(":spring-boot-project:spring-boot-jms"))
2828
optional(project(":spring-boot-project:spring-boot-jsonb"))
2929
optional(project(":spring-boot-project:spring-boot-reactor-netty"))
3030
optional(project(":spring-boot-project:spring-boot-tomcat"))

spring-boot-project/spring-boot-autoconfigure-all/build.gradle

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ dependencies {
4242
dockerTestImplementation("org.testcontainers:pulsar")
4343
dockerTestImplementation("org.testcontainers:testcontainers")
4444

45+
optional(project(":spring-boot-project:spring-boot-activemq"))
4546
optional(project(":spring-boot-project:spring-boot-jackson"))
4647
optional(project(":spring-boot-project:spring-boot-jsonb"))
47-
optional(project(":spring-boot-project:spring-boot-jms"))
4848
optional(project(":spring-boot-project:spring-boot-reactor-netty"))
4949
optional(project(":spring-boot-project:spring-boot-tomcat"))
5050
optional("co.elastic.clients:elasticsearch-java") {
@@ -84,8 +84,6 @@ dependencies {
8484
optional("jakarta.ws.rs:jakarta.ws.rs-api")
8585
optional("javax.cache:cache-api")
8686
optional("javax.money:money-api")
87-
optional("org.apache.activemq:activemq-broker")
88-
optional("org.apache.activemq:activemq-client")
8987
optional("org.apache.activemq:artemis-jakarta-client") {
9088
exclude group: "commons-logging", module: "commons-logging"
9189
}

spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/JtaAutoConfiguration.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
2222
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
2323
import org.springframework.boot.autoconfigure.jdbc.XADataSourceAutoConfiguration;
24-
import org.springframework.boot.autoconfigure.jms.activemq.ActiveMQAutoConfiguration;
2524
import org.springframework.boot.autoconfigure.jms.artemis.ArtemisAutoConfiguration;
2625
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
2726
import org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration;
@@ -36,9 +35,11 @@
3635
* @author Nishant Raut
3736
* @since 1.2.0
3837
*/
39-
@AutoConfiguration(before = { XADataSourceAutoConfiguration.class, ActiveMQAutoConfiguration.class,
40-
ArtemisAutoConfiguration.class, HibernateJpaAutoConfiguration.class, TransactionAutoConfiguration.class,
41-
TransactionManagerCustomizationAutoConfiguration.class })
38+
@AutoConfiguration(
39+
before = { XADataSourceAutoConfiguration.class, ArtemisAutoConfiguration.class,
40+
HibernateJpaAutoConfiguration.class, TransactionAutoConfiguration.class,
41+
TransactionManagerCustomizationAutoConfiguration.class },
42+
beforeName = "org.springframework.boot.activemq.autoconfigure.ActiveMQAutoConfiguration")
4243
@ConditionalOnClass(jakarta.transaction.Transaction.class)
4344
@ConditionalOnBooleanProperty(name = "spring.jta.enabled", matchIfMissing = true)
4445
@Import(JndiJtaConfiguration.class)

0 commit comments

Comments
 (0)