解压使用Apache骆驼UnZippedMessageProcessor文件 [英] Unzip a file using Apache Camel UnZippedMessageProcessor

查看:749
本文介绍了解压使用Apache骆驼UnZippedMessageProcessor文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图解压使用Apache骆驼的文件,我想在 HTTP给出的例子:/ /camel.apache.org/zip-file-dataformat.html 但我无法找到的 UnZippedMessageProcessor ​​类。这里的code:

Trying to unzip a file using Apache Camel, I tried the example given in http://camel.apache.org/zip-file-dataformat.html but I can't find UnZippedMessageProcessor class. Here's the code:

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();

}
}

任何试图做到这一点还是有其他的方式,通过一个骆驼的路线解压缩文件?

Anyone tried to do this or have another way to unzip a file through a Camel route?

感谢你在前进!

推荐答案

您还可以定义这样的路线,你可以找到在 ZipSplitter 骆驼压缩文件内。

You can also define the route like this, you can find the ZipSplitter inside of camel-zipfile.

 from("file:src/test/resources/org/apache/camel/dataformat/zipfile?consumer.delay=1000&noop=true")
  .split(new ZipSplitter())
  .streaming().convertBodyTo(String.class).to("mock:processZipEntry")
  .end()

这篇关于解压使用Apache骆驼UnZippedMessageProcessor文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆