Created
April 20, 2014 12:00
-
-
Save kurogelee/11112466 to your computer and use it in GitHub Desktop.
ClojureからApache Camelを使ってみる ref: http://qiita.com/kurogelee/items/301b69f77ac63f80e69f
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
(ns camel-sample.core | |
(:import [org.apache.camel.impl DefaultCamelContext] | |
[org.apache.camel.builder RouteBuilder]) | |
(:gen-class)) | |
(let [context (DefaultCamelContext.)] | |
(.addRoutes context (proxy [RouteBuilder] [] | |
(configure [] (.. this | |
(from "file:src/camel_sample?noop=true") | |
(to "file:.?fileName=out.txt"))))) | |
(.start context)) |
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
(ns camel-sample.core | |
(:import [org.apache.camel.impl DefaultCamelContext] | |
[org.apache.camel.builder RouteBuilder]) | |
(:gen-class)) | |
(defn- create-builder [f] | |
(proxy [RouteBuilder] [] (configure [] (f this)))) | |
(defmacro add-route [context & body] | |
`(.addRoutes ~context (create-builder (fn [~'this] (.. ~'this ~@body))))) | |
(def c (DefaultCamelContext.)) | |
(add-route c (from "file:src/camel_sample?noop=true") | |
(to "file:.?fileName=out.txt")) | |
(.start c) |
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
:dependencies [[org.apache.camel/camel-core "2.13.0"] [org.clojure/clojure "1.6.0"]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment