ACS-1215 Update JMS/ActiveMQ configuration after the Camel 3.7 upgrade (#274)

- add an **activemq** messaging component bean (of type `org.apache.camel.component.activemq.ActiveMQComponent`)
- add a common **jmsConfig** bean to be used by all the three messaging component beans: **jms**, **activemq** and **amqp**
- exclude `activemq-broker` dependencies
- remove unnecessary messaging configuration
This commit is contained in:
CezarLeahu
2021-02-07 22:35:21 +02:00
committed by GitHub
parent f6166297d3
commit 2171bcc192
6 changed files with 39 additions and 253 deletions

22
pom.xml
View File

@@ -256,6 +256,12 @@
<groupId>org.alfresco.services</groupId> <groupId>org.alfresco.services</groupId>
<artifactId>alfresco-messaging-repo</artifactId> <artifactId>alfresco-messaging-repo</artifactId>
<version>${dependency.alfresco-messaging-repo.version}</version> <version>${dependency.alfresco-messaging-repo.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-broker</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.alfresco</groupId> <groupId>org.alfresco</groupId>
@@ -728,6 +734,22 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-activemq</artifactId>
<version>${dependency.camel.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-broker</artifactId>
</exclusion>
<!-- Duplicates classes from jakarta.transaction:jakarta.transaction-api -->
<exclusion>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jta_1.1_spec</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency> <dependency>
<groupId>org.apache.camel</groupId> <groupId>org.apache.camel</groupId>
<artifactId>camel-amqp</artifactId> <artifactId>camel-amqp</artifactId>

View File

@@ -667,6 +667,10 @@
<groupId>org.apache.camel</groupId> <groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId> <artifactId>camel-spring</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-activemq</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.apache.camel</groupId> <groupId>org.apache.camel</groupId>
<artifactId>camel-amqp</artifactId> <artifactId>camel-amqp</artifactId>
@@ -693,23 +697,6 @@
<artifactId>activemq-client</artifactId> <artifactId>activemq-client</artifactId>
<version>${dependency.activemq.version}</version> <version>${dependency.activemq.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-broker</artifactId>
<version>${dependency.activemq.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-activemq</artifactId>
<version>${dependency.camel.version}</version>
<exclusions>
<!-- Duplicates classes from jakarta.transaction:jakarta.transaction-api -->
<exclusion>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jta_1.1_spec</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency> <dependency>
<groupId>org.apache.activemq</groupId> <groupId>org.apache.activemq</groupId>
<artifactId>activemq-pool</artifactId> <artifactId>activemq-pool</artifactId>

View File

@@ -1,202 +0,0 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<!-- START SNIPPET: example -->
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
<!-- Global properties used in property expansion throughout the container, overridable via JNDI or System properties -->
<bean id="global-properties" class="org.alfresco.config.JndiPropertiesFactoryBean">
<property name="locations">
<list>
<value>classpath:alfresco/repository.properties</value>
<value>alfresco/subsystems/Messaging/default/activemq/credentials.properties</value>
<value>alfresco/subsystems/Messaging/default/messaging.properties</value>
<!-- Enterprise defaults -->
<!-- Overrides supplied if this is an enterprise install (none exist for community) -->
<value>classpath*:alfresco/enterprise/repository.properties</value>
<!-- <value>classpath:alfresco/jndi.properties</value> -->
<!-- Overrides supplied by modules -->
<value>classpath*:alfresco/module/*/alfresco-global.properties</value>
<!-- Installer or user-provided defaults -->
<value>classpath*:alfresco-global.properties</value>
</list>
</property>
<property name="systemPropertiesModeName">
<value>SYSTEM_PROPERTIES_MODE_OVERRIDE</value>
</property>
<property name="propertiesPersister">
<bean class="org.alfresco.config.AlfrescoPropertiesPersister"/>
</property>
</bean>
<bean id="activemq-placeholder-configurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="valueSeparator">
<null/>
</property>
<property name="ignoreUnresolvablePlaceholders">
<value>true</value>
</property>
<property name="searchSystemEnvironment">
<value>false</value>
</property>
<property name="propertiesPersister">
<bean class="org.alfresco.config.AlfrescoPropertiesPersister"/>
</property>
<property name="properties">
<ref bean="global-properties"/>
</property>
</bean>
<!--
The <broker> element is used to configure the ActiveMQ broker.
-->
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}">
<!--
For better performances use VM cursor and small memory limit.
For more information, see:
http://activemq.apache.org/message-cursors.html
Also, if your producer is "hanging", it's probably due to producer flow control.
For more information, see:
http://activemq.apache.org/producer-flow-control.html
-->
<destinationPolicy>
<policyMap>
<policyEntries>
<policyEntry topic=">" producerFlowControl="true">
<!-- The constantPendingMessageLimitStrategy is used to prevent
slow topic consumers to block producers and affect other consumers
by limiting the number of messages that are retained
For more information, see:
http://activemq.apache.org/slow-consumer-handling.html
-->
<pendingMessageLimitStrategy>
<constantPendingMessageLimitStrategy limit="1000"/>
</pendingMessageLimitStrategy>
</policyEntry>
<policyEntry queue=">" producerFlowControl="true" memoryLimit="1mb">
<!-- Use VM cursor for better latency
For more information, see:
http://activemq.apache.org/message-cursors.html
<pendingQueuePolicy>
<vmQueueCursor/>
</pendingQueuePolicy>
-->
</policyEntry>
</policyEntries>
</policyMap>
</destinationPolicy>
<!--
The managementContext is used to configure how ActiveMQ is exposed in
JMX. By default, ActiveMQ uses the MBean server that is started by
the JVM. For more information, see:
http://activemq.apache.org/jmx.html
-->
<managementContext>
<managementContext createConnector="false"/>
</managementContext>
<!--
Configure message persistence for the broker. The default persistence
mechanism is the KahaDB store (identified by the kahaDB tag).
For more information, see:
http://activemq.apache.org/persistence.html
-->
<persistenceAdapter>
<kahaDB directory="${activemq.data}/kahadb"/>
</persistenceAdapter>
<!--
The systemUsage controls the maximum amount of space the broker will
use before slowing down producers. For more information, see:
http://activemq.apache.org/producer-flow-control.html
If using ActiveMQ embedded - the following limits could safely be used:
<systemUsage>
<systemUsage>
<memoryUsage>
<memoryUsage limit="20 mb"/>
</memoryUsage>
<storeUsage>
<storeUsage limit="1 gb"/>
</storeUsage>
<tempUsage>
<tempUsage limit="100 mb"/>
</tempUsage>
</systemUsage>
</systemUsage>
-->
<systemUsage>
<systemUsage>
<memoryUsage>
<memoryUsage limit="64 mb"/>
</memoryUsage>
<storeUsage>
<storeUsage limit="100 gb"/>
</storeUsage>
<tempUsage>
<tempUsage limit="50 gb"/>
</tempUsage>
</systemUsage>
</systemUsage>
<!--
The transport connectors expose ActiveMQ over a given protocol to
clients and other brokers. For more information, see:
http://activemq.apache.org/configuring-transports.html
-->
<transportConnectors>
<!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
<transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
<transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
</transportConnectors>
<!-- destroy the spring context on shutdown to stop jetty -->
<shutdownHooks>
<bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook" />
</shutdownHooks>
</broker>
<!--
Enable web consoles, REST and Ajax APIs and demos
Take a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details
-->
<!--
<import resource="jetty.xml"/>
-->
</beans>
<!-- END SNIPPET: example -->

View File

@@ -1,22 +0,0 @@
## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You 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.
## ---------------------------------------------------------------------------
# Defines credentials that will be used by components (like web console) to access the broker
activemq.username=system
activemq.password=manager
guest.password=password

View File

@@ -29,16 +29,22 @@
<property name="connectionFactory" ref="pooledConnectionFactory"/> <property name="connectionFactory" ref="pooledConnectionFactory"/>
</bean> </bean>
<bean id="amqp" class="org.apache.camel.component.amqp.AMQPComponent"> <bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="pooledConnectionFactory" /> <property name="connectionFactory" ref="pooledConnectionFactory" />
<property name="transacted" value="${messaging.transacted}" /> <property name="transacted" value="${messaging.transacted}" />
<property name="transactionManager" ref="messagingTransactionManager" /> <property name="transactionManager" ref="messagingTransactionManager" />
</bean> </bean>
<bean id="jms" class="org.apache.camel.component.jms.JmsComponent"> <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory" ref="pooledConnectionFactory" /> <property name="configuration" ref="jmsConfig"/>
<property name="transacted" value="${messaging.transacted}" /> </bean>
<property name="transactionManager" ref="messagingTransactionManager" />
<bean id="activemq" class="org.apache.camel.component.activemq.ActiveMQComponent">
<property name="configuration" ref="jmsConfig"/>
</bean>
<bean id="amqp" class="org.apache.camel.component.amqp.AMQPComponent">
<property name="configuration" ref="jmsConfig"/>
</bean> </bean>
<bean id="CAMEL_PROPAGATION_MANDATORY" class="org.apache.camel.spring.spi.SpringTransactionPolicy"> <bean id="CAMEL_PROPAGATION_MANDATORY" class="org.apache.camel.spring.spi.SpringTransactionPolicy">

View File

@@ -1,8 +1,3 @@
# Embedded broker persisting to ${dir.root}/activemq
#messaging.broker.url=vm://localhost?brokerConfig=xbean:alfresco/subsystems/Messaging/default/activemq/activemq.xml
#activemq.data=${dir.root}/activemq
# External failover broker at tcp://localhost # External failover broker at tcp://localhost
messaging.broker.url=failover:(tcp://localhost:61616)?timeout=3000&jms.useCompression=true messaging.broker.url=failover:(tcp://localhost:61616)?timeout=3000&jms.useCompression=true
messaging.broker.ssl=false messaging.broker.ssl=false