Skip to content

Instantly share code, notes, and snippets.

@monodot
Created January 8, 2016 17:01
Show Gist options
  • Save monodot/1eb87a9e50069cabf7dc to your computer and use it in GitHub Desktop.
Save monodot/1eb87a9e50069cabf7dc to your computer and use it in GitHub Desktop.
Camel: subscribe to an ActiveMQ Advisory topic and route messages to a file so they can be easily read
<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">
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="activemq:topic:ActiveMQ.Advisory.Connection?mapJmsMessage=false" />
<convertBodyTo type="java.lang.String"/>
<transform>
<simple>${in.body}&#13;--- &#13; &#13; </simple>
</transform>
<to uri="file://C:/temp/activemq/?fileExist=Append&amp;fileName=ActiveMQ.Advisory.Connection-${date:now:yyyyMMdd}.txt" />
</route>
</camelContext>
<bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="brokerURL" value="tcp://localhost:61616"/>
</bean>
</beans>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment