I managed to get it running. But now got hit with the usual beginners
problem. Following is what I see in my console when I run my program:
[ main] DefaultCamelContext INFO
Apache Camel 2.9.0.fuse-70-097 (CamelContext: camel-1) is starting
[ main] ManagementStrategyFactory INFO JMX
enabled.
[ main] ultManagementLifecycleStrategy INFO
StatisticsLevel at All so enabling load performance statistics
[ main] DefaultTypeConverter INFO
Loaded 169 type converters
[ main] DefaultCamelContext INFO
Route: route1 started and consuming from: Endpoint[file://test.xml]
[ main] DefaultCamelContext INFO Total
1 routes, of which 1 is started.
[ main] DefaultCamelContext INFO
Apache Camel 2.9.0.fuse-70-097 (CamelContext: camel-1) started in 0.509
seconds
[ main] DefaultCamelContext INFO
Apache Camel 2.9.0.fuse-70-097 (CamelContext: camel-1) is shutting down
[ main] DefaultShutdownStrategy INFO
Starting to graceful shutdown 1 routes (timeout 300 seconds)
[el-1) thread #2 - ShutdownTask] DefaultShutdownStrategy INFO
Route: route1 shutdown complete, was consuming from:
Endpoint[file://test.xml]
[ main] DefaultShutdownStrategy INFO
Graceful shutdown of 1 routes completed in 0 seconds
[ main] DefaultTypeConverter INFO
TypeConverterRegistry utilization[attempts=0, hits=0, misses=0, failures=0]
mappings[total=169, misses=0]
[ main] DefaultCamelContext INFO
Apache Camel 2.9.0.fuse-70-097 (CamelContext: camel-1) is shutdown in 0.008
seconds. Uptime 10.523 seconds.
Process finished with exit code 0
Following is how I have managed to made my program work:
object TradeRouter extends App {
override def main(args : Array[String]) {
val camelContext = new DefaultCamelContext()
camelContext.addRoutes(new RouteBuilder() {
def configure() {
from("file:test.xml").to("file:test1.xml")
}
})
camelContext.start()
Thread.sleep(10000)
camelContext.stop()
}
}
Any reasons as to why I cannot see the test1.xml?
Regards,
Joe
On Mon, Feb 11, 2013 at 5:05 PM, Matthias Lüneberg <
[email protected]> wrote:
> Hi,
>
> I think you don't need the "configure()" function/method.
>
> I think its okay to call "to" on the String, there is some implicit magic
> in between I think.
>
> Look at here: http://camel.apache.org/scala-dsl-getting-started.html
>
> The following worked for me in IntelliJ 12:
>
> class SimpleRouter extends App {
>
> def main(args : Array[String]) {
>
> val camelContext = new DefaultCamelContext()
>
> camelContext.addRoutes(new RouteBuilder() {
>
>
> "file://Users/joe/Desktop/test.xml".to("file://Users/joe/Desktop/test1.xml")
>
> })
>
> camelContext.start()
>
> Thread.sleep(1000)
>
> camelContext.stop()
> }
> }
>
> HTH,
> Matthias
>
> Am 11.02.2013 um 13:36 schrieb James Carman <[email protected]
> >:
>
> > How about from("file://...").to("file:///")
> >
> > You're trying to call "to" on a java.lang.String literal object.
> >
> > On Feb 11, 2013, at 5:30 AM, Joe San <[email protected]> wrote:
> >
> >> Guys,
> >>
> >> I'm just trying a simple Scala DSL using intelli. I have a project
> created
> >> and tried configuring a simple route as below:
> >>
> >> class SimpleRouter extends App {
> >>
> >> def main(args : Array[String]) {
> >>
> >> val camelContext = new DefaultCamelContext()
> >>
> >> camelContext.addRoutes(new RouteBuilder() {
> >> def configure() {
> >>
> >>
> "file://Users/joe/Desktop/test.xml".to("file://Users/joe/Desktop/test1.xml")
> >> }
> >> })
> >>
> >> camelContext.start()
> >>
> >> Thread.sleep(1000)
> >>
> >> camelContext.stop()
> >>
> >> }
> >>
> >> }
> >>
> >> But I get to see the following error when I tried to run the above
> route:
> >>
> >> scala: value to is not a member of java.lang.String
> >>
> >>
> "file://Users/joe/Desktop/test.xml".to("file://Users/joe/Desktop/test1.xml")
> >>
> >> Any idea as to why the intellij would not recognize the dsl? Is there
> >> anything that I have to do additionally?
> >>
> >> Regards,
> >> Joe
> >> ^
> >
>
>