Hey Claus, Thanks for that example. That worked, but when we are calling stop the cosumer stops polling. What should we do to make it poll forever. Basically i want a directory poller which continuously poll a directory read files matching with a regex. Process message payload and write them to a different location. Thanks and Regards, Hrishikesh Joshi
Claus Ibsen-2 wrote: > > Hi > > You need to start the consumer first > > consumer.start() before calling the receive() and stop() it also after > use. > > See this unit test > http://svn.apache.org/viewvc?rev=894683&view=rev > > On Wed, Dec 30, 2009 at 2:30 PM, hjoshi <[email protected]> > wrote: >> >> Still nothing is being read..... >> >> Claus Ibsen-2 wrote: >>> >>> On Wed, Dec 30, 2009 at 2:13 PM, hjoshi <[email protected]> >>> wrote: >>>> >>>> Hi Claus, >>>> Thanks for reply. >>>> I have written some code >>>> public static void main(String[] args) { >>>> CamelContext context = new DefaultCamelContext(); >>>> try{ >>>> Endpoint endpoint = >>>> context.getEndpoint("file:/opt/swift/in?fileName=MT941.fin&delay=2000"); >>>> PollingConsumer consumer = >>>> endpoint.createPollingConsumer(); >>>> Exchange exchange = consumer.receive(); >>>> System.out.println("Message : >>>> "+exchange.getIn()); >>>> >>>> } catch (Exception e) { >>>> // TODO Auto-generated catch block >>>> e.printStackTrace(); >>>> } >>>> This just run successfully but dosen't read file. >>>> Can u please suggest correctins? >>> >>> Try with, which forces Camel to read the file and output its message >>> body >>> >>> System.out.println("Message : >>> "+exchange.getIn().getBody(String.class)); >>> >>> >>> >>>> Thanks and Regards, >>>> Hrishikesh Joshi >>>> >>>> Claus Ibsen-2 wrote: >>>>> >>>>> On Wed, Dec 30, 2009 at 12:09 PM, hjoshi <[email protected]> >>>>> wrote: >>>>>> >>>>>> Hi all, >>>>>> I am a newbie to camel using for first time. >>>>>> I want to poll a directory for some files. >>>>>> I want to read and Process those files and then write them to a >>>>>> different >>>>>> location. >>>>>> Can someone provide me an example to achieve this in java class. >>>>>> I dont want to use xml configuration >>>>> >>>>> You can read section 1.5 from the free chapter in the Camel in Action >>>>> book which does this >>>>> http://www.manning.com/ibsen/ >>>>> >>>>> And there are also some newbie documentation at >>>>> http://camel.apache.org/getting-started.html >>>>> >>>>> And the articles section have some good blogs/links for other new >>>>> users with Camel >>>>> http://camel.apache.org/articles.html >>>>> >>>>> >>>>>> -- >>>>>> View this message in context: >>>>>> http://old.nabble.com/File-Read-using-java-tp26965934p26965934.html >>>>>> Sent from the Camel - Users mailing list archive at Nabble.com. >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Claus Ibsen >>>>> Apache Camel Committer >>>>> >>>>> Author of Camel in Action: http://www.manning.com/ibsen/ >>>>> Open Source Integration: http://fusesource.com >>>>> Blog: http://davsclaus.blogspot.com/ >>>>> Twitter: http://twitter.com/davsclaus >>>>> >>>>> >>>> >>>> -- >>>> View this message in context: >>>> http://old.nabble.com/File-Read-using-java-tp26965934p26967343.html >>>> Sent from the Camel - Users mailing list archive at Nabble.com. >>>> >>>> >>> >>> >>> >>> -- >>> Claus Ibsen >>> Apache Camel Committer >>> >>> Author of Camel in Action: http://www.manning.com/ibsen/ >>> Open Source Integration: http://fusesource.com >>> Blog: http://davsclaus.blogspot.com/ >>> Twitter: http://twitter.com/davsclaus >>> >>> >> >> -- >> View this message in context: >> http://old.nabble.com/File-Read-using-java-tp26965934p26967521.html >> Sent from the Camel - Users mailing list archive at Nabble.com. >> >> > > > > -- > Claus Ibsen > Apache Camel Committer > > Author of Camel in Action: http://www.manning.com/ibsen/ > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http://twitter.com/davsclaus > > -- View this message in context: http://old.nabble.com/File-Read-using-java-tp26965934p26975580.html Sent from the Camel - Users mailing list archive at Nabble.com.
