Fix Artemis EmbeddedJMS initialization
Update `ArtemisConnectionFactoryFactory` to reference the new embedded Artemis classes. See gh-16646
This commit is contained in:
@@ -43,7 +43,8 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
class ArtemisConnectionFactoryFactory {
|
||||
|
||||
static final String EMBEDDED_JMS_CLASS = "org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS";
|
||||
static final String[] EMBEDDED_JMS_CLASSES = { "org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS",
|
||||
"org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ" };
|
||||
|
||||
private final ArtemisProperties properties;
|
||||
|
||||
@@ -67,12 +68,14 @@ class ArtemisConnectionFactoryFactory {
|
||||
}
|
||||
|
||||
private void startEmbeddedJms() {
|
||||
if (ClassUtils.isPresent(EMBEDDED_JMS_CLASS, null)) {
|
||||
try {
|
||||
this.beanFactory.getBeansOfType(Class.forName(EMBEDDED_JMS_CLASS));
|
||||
}
|
||||
catch (Exception ex) {
|
||||
// Ignore
|
||||
for (int i = 0; i < EMBEDDED_JMS_CLASSES.length; i++) {
|
||||
if (ClassUtils.isPresent(EMBEDDED_JMS_CLASSES[i], null)) {
|
||||
try {
|
||||
this.beanFactory.getBeansOfType(Class.forName(EMBEDDED_JMS_CLASSES[i]));
|
||||
}
|
||||
catch (Exception ex) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,12 +96,21 @@ class ArtemisConnectionFactoryFactory {
|
||||
* @return the mode
|
||||
*/
|
||||
private ArtemisMode deduceMode() {
|
||||
if (this.properties.getEmbedded().isEnabled() && ClassUtils.isPresent(EMBEDDED_JMS_CLASS, null)) {
|
||||
if (this.properties.getEmbedded().isEnabled() && isEmbeddedJmsClassPresent()) {
|
||||
return ArtemisMode.EMBEDDED;
|
||||
}
|
||||
return ArtemisMode.NATIVE;
|
||||
}
|
||||
|
||||
private boolean isEmbeddedJmsClassPresent() {
|
||||
for (int i = 0; i < EMBEDDED_JMS_CLASSES.length; i++) {
|
||||
if (ClassUtils.isPresent(EMBEDDED_JMS_CLASSES[i], null)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private <T extends ActiveMQConnectionFactory> T createEmbeddedConnectionFactory(Class<T> factoryClass)
|
||||
throws Exception {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user