I was experimenting Apache Camel and ServiceMix in a setting with multiple servers. Camel is a routing engine which implements enterprise integration patterns and ServiceMix can be called an enterprise service bus (ESB) which packages Camel as a router, ActiveMQ as a JMS queue, and Karaf as an OSGi container. All established open-source software released under the friendly Apache umbrella.

Using a message queue is a tested way to distribute tasks to remote servers in a decoupled fashion. ServiceMix ships with an ActiveMQ broker out of the box and here are steps to configure ServiceMix to send or read messages from a remote queue.

ServiceMix is ready run instantly after unzipping the download package. On the server where ActiveMQ broker is to be run simple authentication can be set by adding the following in etc/activemq.xml.

<plugins>
 <simpleAuthenticationPlugin>
  <users>
   <authenticationUser username="system" password="manager"
    groups="users,admins"/>
  </users>
 </simpleAuthenticationPlugin>
</plugins>

Then on another server running ServiceMix which sends or reads messages from the remote queue this route could be used to write a message.

<beans xmlns="http://www.springframework.org/schema/beans"
 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-2.0.xsd
 http://camel.apache.org/schema/spring 
 http://camel.apache.org/schema/spring/camel-spring.xsd"> 
 <bean id="activemqremote" 
    class="org.apache.activemq.camel.component.ActiveMQComponent">
  <property name="brokerURL" value="tcp://remoteserver:61616"/>
  <property name="userName" value="system"/>
  <property name="password" value="manager"/>
 </bean>
 <camelContext xmlns="http://camel.apache.org/schema/spring">
  <route>
   <from uri="file:activemq/input"/>
   <to uri="file:activemq/output"/>
   <setBody>
    <simple>
     FileMovedEvent(file: ${file:name}, timestamp: ${date:now:hh:MM:ss.SSS})
    </simple>
   </setBody>
   <to uri="activemqremote:queue:events" />
  </route>
 </camelContext>
</beans>

Also Spring XML routes can be directly placed in the ServiceMix deploy directory. The OSGi container will bundle and deploy them automatically. Adding a test file in activemq/input directory results in an event in the remote queue.

The ActiveMQ web interface is accessible in http://remoteserver:8181/activemqweb after running these commands in the ServiceMix console.

features:uninstall activemq-broker-noweb
features:install activemq-broker