Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reinstate support for auto-configuring an embedded ActiveMQ broker #40029

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ dependencies {
optional("jakarta.servlet:jakarta.servlet-api")
optional("javax.cache:cache-api")
optional("org.apache.activemq:activemq-client")
optional("org.apache.activemq:activemq-broker")
optional("org.apache.commons:commons-dbcp2") {
exclude group: "commons-logging", module: "commons-logging"
}
Expand Down
1 change: 1 addition & 0 deletions spring-boot-project/spring-boot-autoconfigure/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ dependencies {
optional("javax.cache:cache-api")
optional("javax.money:money-api")
optional("org.apache.activemq:activemq-client")
optional("org.apache.activemq:activemq-broker")
optional("org.apache.activemq:artemis-jakarta-client") {
exclude group: "commons-logging", module: "commons-logging"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,21 @@
@ConfigurationProperties(prefix = "spring.activemq")
public class ActiveMQProperties {

private static final String DEFAULT_EMBEDDED_BROKER_URL = "vm://localhost?broker.persistent=false";

private static final String DEFAULT_NETWORK_BROKER_URL = "tcp://localhost:61616";

/**
* URL of the ActiveMQ broker. Auto-generated by default.
*/
private String brokerUrl;

/**
* Whether the default broker URL should be in memory. Ignored if an explicit broker
* has been specified.
*/
private boolean inMemory = true;

/**
* Login user of the broker.
*/
Expand Down Expand Up @@ -83,6 +91,14 @@ public void setBrokerUrl(String brokerUrl) {
this.brokerUrl = brokerUrl;
}

public boolean isInMemory() {
return this.inMemory;
}

public void setInMemory(boolean inMemory) {
this.inMemory = inMemory;
}

public String getUser() {
return this.user;
}
Expand Down Expand Up @@ -132,8 +148,11 @@ public Packages getPackages() {
}

String determineBrokerUrl() {
if (this.brokerUrl != null) {
return this.brokerUrl;
if (this.getBrokerUrl() != null) {
return this.getBrokerUrl();
}
if (this.isInMemory()) {
return DEFAULT_EMBEDDED_BROKER_URL;
}
return DEFAULT_NETWORK_BROKER_URL;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ dependencies {
api(project(":spring-boot-project:spring-boot-starters:spring-boot-starter"))
api("org.springframework:spring-jms")
api("org.apache.activemq:activemq-client")
api("org.apache.activemq:activemq-broker")
}
Loading