Hi ,

I have problems in copying the files from data/inbox to data/outbox using
Camel with Spring DSL . Below are my beans.xml and Java Programs. Also I am
not seeing processor getting added. 

Please help me on this. 

 

beans.xml

 

<beans xmlns="http://www.springframework.org/schema/beans";

       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

       xsi:schemaLocation="

       http://www.springframework.org/schema/beans 

       http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

       http://camel.apache.org/schema/spring

       http://camel.apache.org/schema/spring/camel-spring.xsd";>

 

 

 

<bean id="fileProcessor" class="com.stark.ftp2jms.FileProcessor"/>

<camelContext id="camelContext"
xmlns="http://camel.apache.org/schema/spring"; autoStartup="false">

       

       <endpoint id="fromFile" uri="file://data/inbox?noop=true"/>

       <endpoint id="toFile" uri="file://data/outbox"/>

       <route>

              <from ref="fromFile"/>

              <process ref="fileProcessor"/>

              <to ref="toFile"/>

       </route>

</camelContext>

 

</beans>

 

 

FileProcessor.java

 

package com.stark.ftp2jms;

 

import org.apache.camel.Exchange;

import org.apache.camel.Processor;

 

public class FileProcessor implements Processor{

 

       public void process(Exchange exchange) throws Exception {

              System.out.println("Just got the file");

              

       }

       

 

}

 

RecieveContentJob.java: This is where I start CamelContext. Even though I do
this, the files are not getting routed from data/inbox to data/outbox. 

 

public class RecieveContentJob {

 

       public static void main(String[] args) {

              ApplicationContext context = new
ClassPathXmlApplicationContext(new String[]{"beans.xml"});

              

              

              

              try {

                     //CamelContext camelContext= scamelContext;

                     CamelContext camel =
SpringCamelContext.springCamelContext(context);

                     System.out.println(camel.getName());

                     camel.start();

                     System.out.println("Running");

                     /*for (Route route:camelContext.getRoutes())

                     {

                           route.toString();

                     }*/

                     

                     Thread.sleep(1000);

                     camel.stop();

              } catch (Exception e) {

                     // TODO Auto-generated catch block

                     e.printStackTrace();

              }

 

       }

 

 

Thanks,

Pavan Naganna

 

Reply via email to