Skip to content

Instantly share code, notes, and snippets.

@jwhitlark
Created June 8, 2010 22:32
Show Gist options
  • Save jwhitlark/430741 to your computer and use it in GitHub Desktop.
Save jwhitlark/430741 to your computer and use it in GitHub Desktop.
(ns org.whitlark.fc
(:import [org.apache.camel.impl DefaultCamelContext])
(:import [org.apache.camel.builder RouteBuilder])
(:gen-class))
(defn -main [& args]
(let [context (DefaultCamelContext.)]
(.addRoutes context (proxy [RouteBuilder] []
(configure []
(.. this (from "file:/home/jw/scratch/inbox?noop=true")
(to "file:/home/jw/scratch/outbox")))))
(.start context)))
public class FileCopierWithCamel {
public static void main(String args[]) throws Exception {
CamelContext context = new DefaultCamelContext();
context.addRoutes(new RouteBuilder() {
public void configure() {
from("file:data/inbox?noop=true")
.to("file:data/outbox");
}
});
context.start();
}
}
(defmacro defroute [context & body]
`(.addRoutes ~context (proxy [RouteBuilder] []
(configure []
(.. ~'this ~@body)))))
(defn -main [& args]
(let [context (DefaultCamelContext.)]
(defroute context
(from "file:/home/jw/scratch/inbox?noop=true")
(to "file:/home/jw/scratch/outbox"))
(.start context)))
(defproject camelFileCopy "0.1.0"
:description "Apache Camel File Copy example in clojure."
:main org.whitlark.fc
:dependencies [[org.clojure/clojure "1.1.0"]
[org.clojure/clojure-contrib "1.1.0"]
[org.apache.camel/camel-core "2.3.0"]
[org.springframework/spring "2.5"]
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment