尝试使用Apache Camel解压缩文件,我尝试了http://camel.apache.org/zip-file-dataformat.html中给出的示例,但我找不到UnZippedMessageProcessor类。下面的代码:使用Apache Camel解压缩文件UnZippedMessageProcessor
import java.util.Iterator;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.dataformat.zipfile.ZipFileDataFormat;
public class TestRoute extends RouteBuilder {
@Override
public void configure() throws Exception {
ZipFileDataFormat zipFile = new ZipFileDataFormat();
zipFile.setUsingIterator(true);
from("file:src/test/resources/org/apache/camel/dataformat/zipfile/")
.unmarshal(zipFile).split(body(Iterator.class)).streaming()
.process(new UnZippedMessageProcessor()).end();
}
}
任何试图做到这一点还是有另一种方式通过骆驼路线解压缩文件?
预先感谢您!
你有你的classpath的骆驼zipfile依赖项? (在你的链接底部描述) – samlewis
是的,我有。我已经检查过camel-zipfile jar,但是我找不到它里面的类,或者其他jar。 – Emowpy
您需要自己编写UnZippedMessageProcessor,我想这只是一个示例名称。 – samlewis