首页 > 解决方案 > 如何在骆驼的休息组件中执行from语句?

问题描述

我为此使用 apache camel。我有一个 http 服务器。当我对 url 执行 get 请求时,它应该从 aws s3 中的存储桶中获取文件,然后在我的本地目录中创建一个文件。

 public static class HelloRoute extends RouteBuilder {
       
        @Override
        public void configure() {
            rest("/")
                
                .get("file-from-s3")
                    .route()
                    .from("aws2-s3://bucketname?accessKey=INSERT&secretKey=INSERT&region=us-east-1&prefix=hello.txt")
                    .to("file:/tmp/")
                    .endRest();
        }

我为此编写了上面的代码,但看起来它忽略了“from”语句并直接执行“to”语句,因此在我的 tmp 目录中创建了一个空文件。还有其他方法可以做到这一点吗?

标签: amazon-web-servicesamazon-s3apache-camelapache-camel-aws

解决方案


推荐阅读