Merge pull request #55 from cborealis/feature/activemq-artemis
Adding support for ActiveMQ Artemis
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright 2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.bindings.boot;
|
||||
|
||||
import org.springframework.cloud.bindings.Binding;
|
||||
import org.springframework.cloud.bindings.Bindings;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static org.springframework.cloud.bindings.boot.Guards.isTypeEnabled;
|
||||
|
||||
/**
|
||||
* An implementation of {@link BindingsPropertiesProcessor} that detects {@link Binding}s of type: {@value TYPE}.
|
||||
*/
|
||||
public final class ArtemisBindingsPropertiesProcessor implements BindingsPropertiesProcessor {
|
||||
|
||||
/**
|
||||
* The {@link Binding} type that this processor is interested in: {@value}.
|
||||
**/
|
||||
public static final String TYPE = "artemis";
|
||||
|
||||
@Override
|
||||
public void process(Environment environment, Bindings bindings, Map<String, Object> properties) {
|
||||
if (!isTypeEnabled(environment, TYPE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
bindings.filterBindings(TYPE).forEach(binding -> {
|
||||
MapMapper map = new MapMapper(binding.getSecret(), properties);
|
||||
|
||||
map.from("host").to("spring.artemis.host");
|
||||
map.from("mode").to("spring.artemis.mode");
|
||||
map.from("password").to("spring.artemis.password");
|
||||
map.from("port").to("spring.artemis.port");
|
||||
map.from("user").to("spring.artemis.user");
|
||||
|
||||
map.from("embedded.cluster-password").to("spring.artemis.embedded.cluster-password");
|
||||
map.from("embedded.data-directory").to("spring.artemis.embedded.data-directory");
|
||||
map.from("embedded.enabled").to("spring.artemis.embedded.enabled");
|
||||
map.from("embedded.persistent").to("spring.artemis.embedded.persistent");
|
||||
map.from("embedded.queues").to("spring.artemis.embedded.queues");
|
||||
map.from("embedded.server-id").to("spring.artemis.embedded.server-id");
|
||||
map.from("embedded.topics").to("spring.artemis.embedded.topics");
|
||||
|
||||
map.from("pool.block-if-full").to("spring.rabbitmq.pool.block-if-full");
|
||||
map.from("pool.block-if-full-timeout").to("spring.rabbitmq.pool.block-if-full-timeout");
|
||||
map.from("pool.enabled").to("spring.rabbitmq.pool.enabled");
|
||||
map.from("pool.idle-timeout").to("spring.rabbitmq.pool.idle-timeout");
|
||||
map.from("pool.max-connections").to("spring.rabbitmq.pool.max-connections");
|
||||
map.from("pool.max-sessions-per-connection").to("spring.rabbitmq.pool.max-sessions-per-connection");
|
||||
map.from("pool.time-between-expiration-check").to("spring.rabbitmq.pool.time-between-expiration-check");
|
||||
map.from("pool.use-anonymous-producers").to("spring.rabbitmq.pool.use-anonymous-producers");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,6 +8,7 @@ org.springframework.boot.env.EnvironmentPostProcessor=\
|
||||
org.springframework.cloud.bindings.boot.BindingSpecificEnvironmentPostProcessor
|
||||
# Included implementations
|
||||
org.springframework.cloud.bindings.boot.BindingsPropertiesProcessor=\
|
||||
org.springframework.cloud.bindings.boot.ArtemisBindingsPropertiesProcessor, \
|
||||
org.springframework.cloud.bindings.boot.CassandraBindingsPropertiesProcessor, \
|
||||
org.springframework.cloud.bindings.boot.ConfigServerBindingsPropertiesProcessor, \
|
||||
org.springframework.cloud.bindings.boot.CouchbaseBindingsPropertiesProcessor, \
|
||||
@@ -26,4 +27,4 @@ org.springframework.cloud.bindings.boot.BindingsPropertiesProcessor=\
|
||||
org.springframework.cloud.bindings.boot.SpringSecurityOAuth2BindingsPropertiesProcessor, \
|
||||
org.springframework.cloud.bindings.boot.SqlServerBindingsPropertiesProcessor, \
|
||||
org.springframework.cloud.bindings.boot.VaultBindingsPropertiesProcessor, \
|
||||
org.springframework.cloud.bindings.boot.WavefrontBindingsPropertiesProcessor
|
||||
org.springframework.cloud.bindings.boot.WavefrontBindingsPropertiesProcessor
|
||||
|
||||
Reference in New Issue
Block a user