0

I have a requirement. We have a CSV file which contains multiple rows.Each Row represents drug information. When i upload the file, i need to take each row and then call a RestFul Service call. currently i am refactoring a for loop using a java.util.concurrent.Executor Service, so that i can make calls parallely. I am thinking of camel.

can someone throw some light on how to use camel in such scenarios.

Current Loop

for(Drug cdrug:drugGroup.getDrugs())
{   
  for(Drug d:drugs)
  {
        if(cdrug.getDrugId().equals(d.getDrugId()))
        {
             httpClient.callRestFulService(d);
        }
  }
}

Regards Ram

Thiyagu
  • 17,362
  • 5
  • 42
  • 79
  • Have a look at the following components: The [file2](http://camel.apache.org/file2.html) endpoint will provide a stream from the file for you. The [splitter](http://camel.apache.org/splitter.html) will read the stream and trigger parallel processing of the lines. The [http4](http://camel.apache.org/http4.html) endpoint allows you to call a REST service. – Ralf Jan 27 '15 at 13:01

1 Answers1

0

Ralf gives you the right headwords.

The Question about processing large csv files will give you an example, with the reading and processing part of your problem.

Community
  • 1
  • 1
DigiNecro
  • 51
  • 1
  • 7