Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Copy Messages from one ActiveMQ instance to another with Apache Camel and Groovy
import org.apache.activemq.camel.component.ActiveMQComponent
import org.apache.camel.CamelContext
import org.apache.camel.builder.RouteBuilder
import org.apache.camel.impl.DefaultCamelContext
class CopyFromOneServerToAnother extends RouteBuilder{
public static void main(String[] args) {
final CamelContext camelContext = new DefaultCamelContext();
// IP address for the queue I will be consuming messages from
camelContext.addComponent("jms-01", ActiveMQComponent.activeMQComponent("tcp://"));
// IP address for the queue I will be placing my consumed messages from
camelContext.addComponent("jms-02", ActiveMQComponent.activeMQComponent("tcp://"));
try {
// Add the routes defined below to the camel context
camelContext.addRoutes(new CopyFromOneServerToAnother());
catch (final Exception e) {
finally {
try {
catch (final Exception e) {
public void configure() throws Exception {
/// The name of the AMQ instance and queue where message will be taken from
// Simply log when each message has been processed
// Additional processors can be used here to alter messages, fix issue with them before being placed on the new queue
// Final resting point for each message.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.