【问题标题】:route reader reading record multiple times in parallel processing路由阅读器在并行处理中多次读取记录
【发布时间】:2022-01-10 19:38:46
【问题描述】:

我的 apache 骆驼路线如下:-

get("fileReaderSvc", fileReaderSvc")
.rocess(e->fileReaderSvc.init(e, ctx)
.split(body().convertToString.tokenize("/n"))
.streming()
.parallelProcessing(true)
.thread(10)
.to("direct:nextRoute")
.end();

get("nextRoute", "nextRoute")
.choice()
.when(body().startWith("HDR"))
.bean("process","processHdr")
.when(body().startsWith("REC"))
.bean("process","processRecord")
.end()

我的问题是我有一个包含 1000 多条记录的文件,其中只有一条以“HDR”开头。但是 processHdr 被多次调用。看起来同步问题。在我看来,多个线程读取相同的记录。此代码主要显示 Linux 上的问题。 请提出建议。

这里 fileReaderSvc 扩展自 FileReaderService 并且 init 和 readFile 调用 super.methods。

【问题讨论】:

    标签: multithreading parallel-processing routes apache-camel synchronization


    【解决方案1】:

    问题不是这个代码。文件移动失败触发多次读取。

    【讨论】:

      猜你喜欢
      • 2023-03-02
      • 1970-01-01
      • 2016-04-28
      • 2021-06-23
      • 2017-06-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多