We are moving from an old version of Apache ActiveMQ Classic to Apache ActiveMQ Artemis. We have Artemis up and running and have been consulting documentation, but I'm not seeing how to connect this to an external queues.
Our ActiveMQ flow is to have queues that get messages pushed to them via CURL from various processes in our application. Our client subscribes to those and pulls messages from our queue to theirs for processing. We also do the reverse pulling messages from their queues into ours and then various processes dequeue those messages and process them.
With ActiveMQ we do everything using the Spring XML, and it sounded like it would be compatible, but in the end it looks like the objects we create in our XML beans aren't recognized in Artemis.
Here is the part of our activemq.xml file that we still have yet to translate to new Artemis methods, any help would be much appreciated:
<!-- active mq messaging components -->
<bean id="amqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="vm://localhost?jms.prefetchPolicy.queuePrefetch=1" />
</bean>
<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="amqConnectionFactory" />
<property name="concurrentConsumers" value="1" />
</bean>
<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="configuration" ref="jmsConfig" />
</bean>
<!-- external server messaging components -->
<bean id="usToThemConnectionFactory" class="com.ibm.mq.jms.MQConnectionFactory">
<property name="transportType" value="1" />
<property name="hostName" value="external.server.ip.address" />
<property name="port" value="1515" />
<property name="queueManager" value="DMZP" />
<property name="channel" value="RECL.SVRCONN" />
</bean>
<bean id="usToThemConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="usToThemConnectionFactory" />
<property name="concurrentConsumers" value="1" />
</bean>
<bean id="websphereOut" class="org.apache.camel.component.jms.JmsComponent">
<property name="configuration" ref="usToThemConfig" />
</bean>
<!-- queue routes -->
<camelContext id="wmqToAmqContext" xmlns="http://camel.apache.org/schema/spring">
<!-- inbound routes -->
<route id="transactionReceiptBridge">
<from uri="websphereIn:queue:THEM.TRANS.RECEIPT.REXI.QL?mapJmsMessage=true" />
<to uri="activemq:queue:US.TRANS.RECEIPT.REXI" />
<convertBodyTo type="java.lang.String" />
</route>
<!-- outbound routes -->
<route id="returnBridge">
<from uri="activemq:queue:US.CORE.RETURN.PTRO" />
<to uri="websphereOut:queue:THEM.CORE.RETURN.PTRO?mapJmsMessage=true" />
</route>
</camelContext>
Thank you very much!
We have tried including the beans in broker.xml
at the end within the configuration root node and Artemis runs without error, but there is no evidence of these structures in the web console so it looks like that is not doing anything.
We're just not really sure if that other server details/connection factory/routes/etc are supposed to be an address, acceptor, etc.
You can deploy Camel routes in ActiveMQ Artemis. However, dropping the XML straight into broker.xml
won't work. You'll need to package and deploy a WAR file as demonstrated in this example.
That said, it may make more sense to simply run your Camel routes standalone. Although this involves managing multiple processes the independence is typically a better option for the following reasons: