Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Routes 使用zipAggregationStrategy时如何在压缩文件中保留原始文件名_Routes_Apache Camel - Fatal编程技术网

Routes 使用zipAggregationStrategy时如何在压缩文件中保留原始文件名

Routes 使用zipAggregationStrategy时如何在压缩文件中保留原始文件名,routes,apache-camel,Routes,Apache Camel,我的路线结构如下: B2BMB文件中的文件ystem://com.abc/sftp/abc/Aggregated001 按顺序命名为:123.dat、456.dat、789.dat。在压缩文件中,这些文件名被重命名为机器ID。我们是否可以保留文件名 <routes xmlns="http://camel.apache.org/schema/spring"> <route id="com.abc.zipFile001" autoStartup="false"> &l

我的路线结构如下:

B2BMB文件中的文件ystem://com.abc/sftp/abc/Aggregated001 按顺序命名为:123.dat、456.dat、789.dat。在压缩文件中,这些文件名被重命名为机器ID。我们是否可以保留文件名

<routes xmlns="http://camel.apache.org/schema/spring">
<route id="com.abc.zipFile001" autoStartup="false">
    <from uri="b2bmbFileSystem://com.abc/sftp/abc/Aggregated001"/>
    <convertBodyTo type="java.lang.String"/>
    <choice id="textZipFile">
        <when>
            <simple>$simple{header.CamelFileName} regex '^.*(dat|DAT)$'</simple>
            <aggregate strategyRef="zipAggregationStrategy" completionFromBatchConsumer="true" eagerCheckCompletion="true">
                <correlationExpression>
                    <constant>true</constant>
                </correlationExpression>
                <setHeader headerName="CamelFileName">
                <simple>${date:now:yyyy-MM-dd-HH-mm-ssSSS}-ZIPFILES.zip</simple>
                </setHeader>
                <to uri="b2bmbFileSystem://com.abc/sftp/abc/shipmentRequestAggregatedPGH"/>
            </aggregate>
        </when>
    </choice>
</route>
</routes>
请参阅ZipAggregationStrategy构造函数选项useFilenameHeader

发件人:

useFilenameHeader-如果为true,则文件名头将用于命名ZIP文件中的聚合字节数组

在SpringXML配置中,您可以通过以下方式定义ZipaggregationStrategybean:

<bean id="zipAggregationStrategy" class="org.apache.camel.processor.aggregate.zipfile.ZipAggregationStrategy">
    <constructor-arg index="0" value="false"/> <!-- preserveFolderStructure -->
    <constructor-arg index="1" value="true"/> <!-- useFilenameHeader -->
</bean>