SHARE
TWEET

Untitled

a guest May 27th, 2018 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env groovy
  2. /**
  3.  * Small example showing how to make a routing
  4.  * in Apache Camel and ActiveMQ in a groovy shell-script.
  5.  *  
  6.  * @author: Marcel Maatkamp (m.maatkamp avec gmail dot com)
  7.  */
  8.  
  9. @Grapes([
  10.   @Grab('org.apache.camel:camel-core:2.3.0'),
  11.   @Grab('org.apache.camel:camel-mina:2.3.0'),
  12.   @Grab('org.apache.camel:camel-jms:2.3.0'),
  13.   @Grab('org.apache.activemq:activemq-core:5.3.2'),
  14.   @Grab('org.apache.activemq:activemq-camel:5.3.2'),
  15.   @Grab('org.slf4j:slf4j-log4j12:1.6.0'),
  16.   @GrabConfig(systemClassLoader = true)
  17. ])
  18.  
  19. import org.apache.camel.builder.RouteBuilder
  20. import org.apache.activemq.ActiveMQConnectionFactory
  21. import org.apache.camel.impl.DefaultCamelContext
  22. import org.apache.camel.component.jms.JmsComponent
  23. import javax.jms.ConnectionFactory
  24.  
  25. def context = new DefaultCamelContext()
  26. def connectionFactory = new ActiveMQConnectionFactory("vm://localhost")
  27. context.addComponent("jms", JmsComponent.jmsComponentAutoAcknowledge(connectionFactory))
  28. context.addRoutes(new RouteBuilder() {
  29.   public void configure() {
  30.     from("ftp://riderautoparts.com/orders"
  31.        + "?username=rider&password=secret")
  32.     .to("jms:incomingOrders")
  33.   }
  34. })
  35.  
  36. context.start()
  37. Thread.sleep(10000)
  38. context.stop()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top