• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Issue with file component (camel is not consuming files from the folder periodically until ends

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am facing one problem with file component.
My requirement is :File component to read the xml/txt/csv file from directory as periodically and store the database.
For above task i wrote the like
Endpoint is folder and camel consuming files from the folder periodically until ends the workflow..

String insertQuery = "insert into tblblacklistednumbers(fldTransactionId,fldPhoneNumber,fldDescription) values (#,#,#)";
System.out.println(insertQuery.trim());
JaxbDataFormat jaxb = new JaxbDataFormat("com.upc.mds.processor");
System.out.println("path in jaxb"+jaxb.getContextPath());
System.out.println("object in jaxb"+jaxb.toString());

from("file://D:/BLNData")
.processRef("test")
.choice()
.when()
.method("fileHelper", "isCsv")
.unmarshal().csv()
.processRef("test")

.processRef("blndataProcessor")
.loop(property("blnLoop"))
.processRef("setBodyProcessor")
//.to("writeSql:call blacklistednumbersprod(#,#,#)")
.to("dataSource:"+insertQuery.trim())
//.to("bean:normalizer")
.end()
.end()
.choice()
.when()
.method("fileHelper", "isXml")
.unmarshal(jaxb)
.processRef("test")
.processRef("blndataProcessor")
.to("dataSource:"+insertQuery.trim())
.processRef("test")
.end()
;

The above code working fine by using the Thread.sleep(n) in my main problem but my requirement in actual project is:
we are used the Reflection in main problem to start the router and The connection is establish/lessening until workflow ends.
Is it possible ?
Please can you provide some ideas
 
reply
    Bookmark Topic Watch Topic
  • New Topic