【问题标题】:How can I move file after Apache Camel Batch processing?如何在 Apache Camel 批处理后移动文件?
【发布时间】:2017-01-31 18:40:30
【问题描述】:

我从 Amazon S3 带来一个文件并使用 Spring Batch 处理它,所有这些都与 Apache Camel 集成。

批处理后,消息体不再是文件内容,而是de Job。但我想将文件移动到另一个 s3 存储桶。如何取回文件内容? (我确实有标题)

(使用 S3 是间接的)

        from("aws-s3://my-bucket...")
            .idempotentConsumer(header("CamelAwsS3Key"),
                  MemoryIdempotentRepository.memoryIdempotentRepository(200))
            .setHeader("CamelFileName", simple("${in.header.CamelAwsS3Key}"))
            .to("file:my-files/")
            .log("Copied from S3.")
            .to("spring-batch:historicoJob")
            .choice()
            .when(simple("${in.body.status} == 'COMPLETED'"))
            .to("direct:moveIt")
            .endChoice();

    from("direct:moveIt")
             ...
            .to("aws-s3://done-bucket...");

【问题讨论】:

    标签: java amazon-s3 spring-boot apache-camel spring-batch


    【解决方案1】:

    您可以访问原始消息(骆驼交换->工作单元上有一些api),或者您可以将消息正文复制到spring批处理之前的交换属性,然后再次恢复。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-06
      • 1970-01-01
      • 2017-08-09
      • 1970-01-01
      • 2019-11-15
      相关资源
      最近更新 更多