Created
June 6, 2010 09:19
-
-
Save marcelmaatkamp/427449 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env groovy | |
/** | |
* Small example showing how to make a routing | |
* in Apache Camel and ActiveMQ in a groovy shell-script. | |
* | |
* @author: Marcel Maatkamp (m.maatkamp avec gmail dot com) | |
*/ | |
@Grapes([ | |
@Grab('org.apache.camel:camel-core:2.3.0'), | |
@Grab('org.apache.camel:camel-mina:2.3.0'), | |
@Grab('org.apache.camel:camel-jms:2.3.0'), | |
@Grab('org.apache.activemq:activemq-core:5.3.2'), | |
@Grab('org.apache.activemq:activemq-camel:5.3.2'), | |
@Grab('org.slf4j:slf4j-log4j12:1.6.0'), | |
@GrabConfig(systemClassLoader = true) | |
]) | |
import org.apache.camel.builder.RouteBuilder | |
import org.apache.activemq.ActiveMQConnectionFactory | |
import org.apache.camel.impl.DefaultCamelContext | |
import org.apache.camel.component.jms.JmsComponent | |
import javax.jms.ConnectionFactory | |
def context = new DefaultCamelContext() | |
def connectionFactory = new ActiveMQConnectionFactory("vm://localhost") | |
context.addComponent("jms", JmsComponent.jmsComponentAutoAcknowledge(connectionFactory)) | |
context.addRoutes(new RouteBuilder() { | |
public void configure() { | |
from("ftp://riderautoparts.com/orders" | |
+ "?username=rider&password=secret") | |
.to("jms:incomingOrders") | |
} | |
}) | |
context.start() | |
Thread.sleep(10000) | |
context.stop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment