Friday, November 14, 2014

First Camel Integration home project

Sanskrit Newspaper - Sanskrit Dictionary integration using Camel
1) spin up a tomcat container running camel (AWS - EC2)
2) pull from articles in http://sudharma.epapertoday.com/
3) event driven pull from dictionary http://spokensanskrit.de/
4) results merged with editorial content on  http://pradyumnsharma.blogspot.in/

Normally I would have gone with a YQL (yahoo query language) solution implemented in javascript, which could be embedded into Pradyumn's blog, but I saw this as a change to architect a simple enrichment pattern in camel, and make this available to him as a webservice.

The camel ETL component also looks promising, so I worked through the example in the Camel download. Be careful that your later version may no longer set the entity manager in the header of the camel exchange -- I simply grabbed the entity manager factory from the exchange via the registry and it worked fine.

Playing around with this example (which uses JPA to consume records as files and insert/update them into a database) naturally led me to consume instead from a webpage (sudharma) -- merely substituting the file component with the http one. WSnotification might be what is under the hood for the camel http endpoint. I ended up making the following changes to get it to work:
(CXF)
Of course, my goal was not merely to load a database, but make the data available via a webservice for the javascript client to have access to. I could have just fronted the database with a Spring Data REST client, but wanted to remain in camel land a while longer. So I am investigating routing to another http component instead.

Final comfy solution resulted in creating a new component: webpage.





No comments:

Post a Comment