骆驼并行处理:无法将RouteDefinition强制转换为org.apache.camel.model.TryDefinition

时间:2019-05-06 04:10:27

标签: apache-camel

我处于驼峰路线下方,当我注释掉self.sql_frame=Frame(self.master) self.sql_frame.place(x=10,y=350) self.sql_frame.place(x=10,y=350)scrolledtext.ScrolledText(self.sql_frame,font=('Times New Roman',14,'bold'),width=87,height=15).grid(row=1,column=1) 部分和parallelProcessing()变幅时,它工作正常,但是当启用end()时,我遇到了错误。

parallelProcessing()

我缺少任何org.apache.camel.spring.boot.CamelSpringBootInitializationException: java.lang.ClassCastException: org.apache.camel.model.RouteDefinition cannot be cast to org.apache.camel.model.TryDefinition 吗?

end()
  
    

完成Stacktrace

  
from("direct:resetRoute")
    .routeId("r-route")
    .log("Starting r-route")
    .doTry()
        .bean(transactionManager, "beginTransaction()")
        .bean(clientApi, "search(${body},${header.region})")
        .setHeader("transactionSize", simple("${body.size()}"))
        .process(objectToXmlProcessor)
        .process(e -> {
            TransactionMaster transactionMaster = transactionMasterService.saveTransactionMaster(String.valueOf(e.getIn().getHeader(Constants.HEADER_1)));
            e.getIn().setHeader(Constants.HEADER_2, transactionMaster);
        })
        .split(simple("${body}"))
            .parallelProcessing()
            .doTry()
                .process(e -> {
                    Transaction transaction = transactionService.saveTransaction((TransactionMaster) e.getIn().getHeader(Constants.HEADER_2),
                            ((StsTxn) e.getIn().getBody()).getTxnId());
                    e.getIn().setHeader(Constants.HEADER_3, transaction);
                })
                .bean(transformationService, "tranform")
                .process(objectToXmlProcessor)
                .process(e -> {
                    Transaction transaction = transactionService.updateMsg(String.valueOf(e.getIn().getBody()), (Transaction) e.getIn().getHeader(Constants.HEADER_3));
                    e.getIn().setHeader(Constants.HEADER_3, transaction);
                })
                .bean("{{t-p.mqservice}}")
                .process(e -> {
                    Transaction transaction = (Transaction) e.getIn().getHeader(Constants.HEADER_3);
                    transactionService.updateMsgStatus(transaction, MsgStatus.SUCCESS);
                })
            .endDoTry()
            .doCatch(Exception.class)
                .log(LoggingLevel.ERROR, "TRANSACTION-EXCEPTION : ${exception.stacktrace}") 
                .process(e -> {
                    Transaction transaction = (Transaction) e.getIn().getHeader(Constants.HEADER_3);
                    transactionService.updateMsgStatus(transaction, MsgStatus.FAILURE);
                })
            .end()
            .end() // End of parallelProcessing()
        .end()// End of split()
        .process(c -> {
            TransactionMaster transactionMaster = (TransactionMaster) c.getIn().getHeader(Constants.HEADER_2);
            transactionMasterService.updateMsgStatus(transactionMaster, MsgStatus.SUCCESS);
        })
        .bean(transactionManager, "markSuccess")
    .endDoTry() // End of doTry()
    .doCatch(Exception.class)
        .bean(transactionManager, "markFailure")
        .log(LoggingLevel.ERROR, "TRANSACTION-MASTER-EXCEPTION : ${exception.stacktrace}")
    .end(); // End of doCatch()

0 个答案:

没有答案