ATS-738 / MNT-21613: Allow option to use -DACTIVEMQ_URL (without needing to also set -Dactivemq.url) (#266)

This commit is contained in:
montgolfiere 2020-07-01 15:45:00 +01:00 committed by GitHub
parent 8cdbc00424
commit 8c7edcda62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 4 deletions

View File

@ -2,7 +2,7 @@
* #%L * #%L
* Alfresco Transform Core * 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. * This file is part of the Alfresco software.
* - * -
@ -49,8 +49,19 @@ public class MessagingInfo
@PostConstruct @PostConstruct
public void init() public void init()
{ {
final boolean jms = activemqUrl != null && !activemqUrl.trim().isEmpty(); // For backwards-compatibility, we continue to rely on setting ACTIVEMQ_URL environment variable (see application.yaml)
logger.info("JMS client is {}, activemq.url: '{}'", jms ? "ENABLED" : "DISABLED", // The MessagingConfig class uses on ConditionalOnProperty (ie. activemq.url is set and not false)
activemqUrl);
// 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");
}
} }
} }

View File

@ -14,6 +14,9 @@ spring:
jackson: jackson:
default-property-inclusion: non_empty default-property-inclusion: non_empty
activemq:
url: ${ACTIVEMQ_URL:false}
server: server:
port: 8090 port: 8090