Apache camel 如何将解组数据处理为原始数据?

Apache camel 如何将解组数据处理为原始数据?,apache-camel,spring-camel,Apache Camel,Spring Camel,我正在用camel实现一些应用程序。 我的情景就像是打击。 1) 在输入目录中收集文件。 2) 使用特定数据格式(fixedLengthFormat)解组文件。 3) 如果文件在解组过程中异常,则会生成一些异常。 4) 如果发生异常,camel将原始文件移动到异常目录。 我发现如下异常 org.apache.camel.component.file.GenericFileOperationFailedException: Cannot store file: C:\home\WRK\PRC\W

我正在用camel实现一些应用程序。 我的情景就像是打击。 1) 在输入目录中收集文件。 2) 使用特定数据格式(fixedLengthFormat)解组文件。 3) 如果文件在解组过程中异常,则会生成一些异常。 4) 如果发生异常,camel将原始文件移动到异常目录。

我发现如下异常

 org.apache.camel.component.file.GenericFileOperationFailedException: Cannot store file: C:\home\WRK\PRC\WLNE\IPTVKR\KRLPPM10\FATAL\SLPNPM_FGIDRO01_ID0006_T20190312050500.DAT
at org.apache.camel.component.file.FileOperations.storeFile(FileOperations.java:354) ~[camel-core-2.23.1.jar:2.23.1]
at org.apache.camel.component.file.GenericFileProducer.writeFile(GenericFileProducer.java:305) ~[camel-core-2.23.1.jar:2.23.1]
at org.apache.camel.component.file.GenericFileProducer.processExchange(GenericFileProducer.java:169) ~[camel-core-2.23.1.jar:2.23.1]
at org.apache.camel.component.file.GenericFileProducer.process(GenericFileProducer.java:80) ~[camel-core-2.23.1.jar:2.23.1]
    ....
这是由于对正文的错误分析而导致的错误。 所以,我在标记之前添加了字符串类型的标记。 我这样做了,没有错误。 但是,移动的文件具有要解组的数据格式,而不是原始数据

我应该如何处理一些代码以获得原始数据

  • 解组的数据格式(KRFixedFormat.java)

  • 骆驼上下文

    <doTry id="_CheckException">
        <camel:convertBodyTo charset="ISO-8859-1"
                        id="_ConvertEncoding" type="java.lang.String"/>
        <camel:unmarshal id="_FileParsing">
           <camel:bindy
                  classType="com.ktds.openmzn.dao.KRFixedFormat"
                            locale="korea" type="Fixed"/>
        </camel:unmarshal>
        <doCatch id="_ParsingException">
           <exception>org.apache.camel.component.bean.MethodNotFoundException</exception>
           <exception>org.apache.camel.NoTypeConversionAvailableException</exception>
           <convertBodyTo charset="ISO-8859-1"
                        id="_ConvertEncoding" type="java.lang.String"/>
           <toD id="_MoveErrorFile" uri="file:${header.CamelFileParent}/FATAL"/>
        </doCatch>
    </doTry>
    ...
    
  • 输出文件

    KRFixedFormat [sType=R, sRecordSeq=0000001, sServiceType=2, sChrgId=69056802668, ....
    

我定制了一种带有页眉、正文和页脚的数据格式。这些格式由每个类定义。这种情况发生在只有一条带有页眉和页脚的正文记录的情况下。我有一个带有页眉、正文和页脚的自定义数据格式。这些格式由每个类定义。这种情况发生在只有一条带有页眉和页脚的正文记录的情况下。
H20190312050500GIDRO01LPNPM  
R0000001269056802668      D201903 ....
T000000120190312050500000000003091
KRFixedFormat [sType=R, sRecordSeq=0000001, sServiceType=2, sChrgId=69056802668, ....