无法让 Camel unmarshal zipfile 工作?
can't get Camel unmarshal zipfile working?
我在骆驼路线上有一个入站压缩或 ZIP 文件。此 zip 文件包含多个 CSV 文件。我还需要在进一步处理之前调整文件内容。看来我可以成功解压缩文件,但无法对其进行解组。似乎多个分离器是一个问题。 ???希望有人能告诉我我做错了什么。如果我从 zip 文件中取出文件,我可以单独处理它们,但我无法从 zip 文件中处理它们。
我试过 ZipFileDataFormat,也试过 ZipSplitter,结果相同。试过 .split(bodyAs(Iterator.class))
} else if (Boolean.parseBoolean(isCompressedOnly)) { //Only Zipped or Compressed
ZipFileDataFormat zipFile = new ZipFileDataFormat();
zipFile.setUsingIterator(true);
from(fromStr)
.routeId(routeId)
.log(LoggingLevel.INFO, "Message received ${file:name} for Only Zipped or Compressed files from host " + host)
.unmarshal(zipFile)
.split(body(Iterator.class))
.streaming()
.convertBodyTo(String.class)
.wireTap("file:" + fileArchive)
.split(body()).streaming()
.process(new EndpointParametersProcessor(decoderName))
.to(toStr)
.end();
在对单个 csv 文件起作用的拆分器操作中添加 tokenize("\n") 似乎已经纠正了我的问题。此外,要将消息记录重新加入单个数据包,请包括聚合策略。
} else if (Boolean.parseBoolean(isCompressedOnly)) { //Only Zipped or Compressed
ZipFileDataFormat zipFile = new ZipFileDataFormat();
zipFile.setUsingIterator(true);
from(fromStr)
.routeId("Zipped.Only")
.log(LoggingLevel.INFO, "Message received ${file:name} for Only Zipped or Compressed files from host " + host)
.unmarshal(zipFile)
.split(body(Iterator.class))
.streaming()
.convertBodyTo(String.class)
.wireTap("file:" + fileArchive)
.split(body().tokenize("\n"), new FleetAggregationStrategy()).streaming()
.process(new EndpointParametersProcessor(decoderName))
.end()
.to(toStr);
我在骆驼路线上有一个入站压缩或 ZIP 文件。此 zip 文件包含多个 CSV 文件。我还需要在进一步处理之前调整文件内容。看来我可以成功解压缩文件,但无法对其进行解组。似乎多个分离器是一个问题。 ???希望有人能告诉我我做错了什么。如果我从 zip 文件中取出文件,我可以单独处理它们,但我无法从 zip 文件中处理它们。
我试过 ZipFileDataFormat,也试过 ZipSplitter,结果相同。试过 .split(bodyAs(Iterator.class))
} else if (Boolean.parseBoolean(isCompressedOnly)) { //Only Zipped or Compressed
ZipFileDataFormat zipFile = new ZipFileDataFormat();
zipFile.setUsingIterator(true);
from(fromStr)
.routeId(routeId)
.log(LoggingLevel.INFO, "Message received ${file:name} for Only Zipped or Compressed files from host " + host)
.unmarshal(zipFile)
.split(body(Iterator.class))
.streaming()
.convertBodyTo(String.class)
.wireTap("file:" + fileArchive)
.split(body()).streaming()
.process(new EndpointParametersProcessor(decoderName))
.to(toStr)
.end();
在对单个 csv 文件起作用的拆分器操作中添加 tokenize("\n") 似乎已经纠正了我的问题。此外,要将消息记录重新加入单个数据包,请包括聚合策略。
} else if (Boolean.parseBoolean(isCompressedOnly)) { //Only Zipped or Compressed
ZipFileDataFormat zipFile = new ZipFileDataFormat();
zipFile.setUsingIterator(true);
from(fromStr)
.routeId("Zipped.Only")
.log(LoggingLevel.INFO, "Message received ${file:name} for Only Zipped or Compressed files from host " + host)
.unmarshal(zipFile)
.split(body(Iterator.class))
.streaming()
.convertBodyTo(String.class)
.wireTap("file:" + fileArchive)
.split(body().tokenize("\n"), new FleetAggregationStrategy()).streaming()
.process(new EndpointParametersProcessor(decoderName))
.end()
.to(toStr);