文件名前缀上的骆驼路线

Camel route on filename prefix

我有一些带扩展的文件

DOA01022016.txt [which is date of admission]
PROFILE01022016.txt [which is student profile] &
RESULTS01022016.txt [which is students results]

So naming convention is PREFIXDDMMYYY.txt

from uri="sftp://10.10.101.10/tmp/admin/?username=admin&password=admin123"

使用骆驼我正在尝试 when --> choice --> simple --> contains --> Headers 方法。

不知何故,这不是一个好的方法。 我也尝试关注 Camel File

还有其他更好的使用骆驼的方法吗?

您应该只在 FTP 路由定义中使用蚂蚁模式包含参数,而不是基于内容的路由:

from("sftp://10.10.101.10/tmp/admin/?username=admin&password=admin123&antInclude=**/DOA*.txt")
    .log("date of admission ${body}");

from("sftp://10.10.101.10/tmp/admin/?username=admin&password=admin123&antInclude=**/PROFILE*.txt")
    .log("student profile ${body}");

from("sftp://10.10.101.10/tmp/admin/?username=admin&password=admin123&antInclude=**/RESULTS*.txt")
    .log("results ${body}");