开发者

Apache camel from ftp to database

Is it possible to solve following scenario with apache camel:

Read from ftp (periodically) retrieve a zip file which contains xml, store this x开发者_如何学运维ml in database.

The main question is which features exists in camel and which functionality and need to write on my own?


Yes, your route could look something like this (off the top of my head):

JaxbDataFormat jaxb = new JaxbDataFormat("com.example.foobar");

from("ftp://user:pass@server:21/inbox")
    .unmarshal().zip()
    .split(xpath("//foo"))
    .unmarshal(jaxb)
    .to("jpa:com.example.foobar.Foo")

This will poll a FTP server, unzip files, split the content in XML fragments, transform these to JPA entities and finally persist these objects in a database. There are many variations possible, depending on your use case you can omit the splitter EIP or for example choose another persistence mechanism (MyBatis, Spring-JDBC, etc).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜