|
|
|
@ -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,15 +68,17 @@ class ArtemisConnectionFactoryFactory {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void startEmbeddedJms() {
|
|
|
|
|
if (ClassUtils.isPresent(EMBEDDED_JMS_CLASS, null)) {
|
|
|
|
|
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_CLASS));
|
|
|
|
|
this.beanFactory.getBeansOfType(Class.forName(EMBEDDED_JMS_CLASSES[i]));
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex) {
|
|
|
|
|
// Ignore
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private <T extends ActiveMQConnectionFactory> T doCreateConnectionFactory(Class<T> factoryClass) throws Exception {
|
|
|
|
|
ArtemisMode mode = this.properties.getMode();
|
|
|
|
@ -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 {
|
|
|
|
|