From 8c7edcda628d61a231d3be810a34d9bc63b374fb Mon Sep 17 00:00:00 2001 From: montgolfiere Date: Wed, 1 Jul 2020 15:45:00 +0100 Subject: [PATCH] ATS-738 / MNT-21613: Allow option to use -DACTIVEMQ_URL (without needing to also set -Dactivemq.url) (#266) --- .../transformer/messaging/MessagingInfo.java | 19 +++++++++++++++---- .../src/main/resources/application.yaml | 3 +++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/MessagingInfo.java b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/MessagingInfo.java index 103998fe..3496d7c8 100644 --- a/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/MessagingInfo.java +++ b/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/MessagingInfo.java @@ -2,7 +2,7 @@ * #%L * Alfresco Transform Core * %% - * Copyright (C) 2005 - 2019 Alfresco Software Limited + * Copyright (C) 2005 - 2020 Alfresco Software Limited * %% * This file is part of the Alfresco software. * - @@ -49,8 +49,19 @@ public class MessagingInfo @PostConstruct public void init() { - final boolean jms = activemqUrl != null && !activemqUrl.trim().isEmpty(); - logger.info("JMS client is {}, activemq.url: '{}'", jms ? "ENABLED" : "DISABLED", - activemqUrl); + // For backwards-compatibility, we continue to rely on setting ACTIVEMQ_URL environment variable (see application.yaml) + // The MessagingConfig class uses on ConditionalOnProperty (ie. activemq.url is set and not false) + + // Note: as per application.yaml the broker url is appended with "?jms.watchTopicAdvisories=false". If this needs to be fully + // overridden then it would require explicitly setting both "spring.activemq.broker-url" *and* "activemq.url" (latter to non-false value). + + if ((activemqUrl != null) && (! activemqUrl.equals("false"))) + { + logger.info("JMS client is ENABLED - ACTIVEMQ_URL ='{}'", activemqUrl); + } + else + { + logger.info("JMS client is DISABLED - ACTIVEMQ_URL is not set"); + } } } diff --git a/alfresco-transformer-base/src/main/resources/application.yaml b/alfresco-transformer-base/src/main/resources/application.yaml index 4191f918..f238afe4 100644 --- a/alfresco-transformer-base/src/main/resources/application.yaml +++ b/alfresco-transformer-base/src/main/resources/application.yaml @@ -14,6 +14,9 @@ spring: jackson: default-property-inclusion: non_empty +activemq: + url: ${ACTIVEMQ_URL:false} + server: port: 8090