简体   繁体   中英

Pull from multiple endpoints in a Camel route

I have a route which grabs json from an endpoint, I was wondering how to extend this such that the route grabs from multiple endpoints instead? So imagine there is a report.2.endpoint , report.3.endpoint , etc..

    from("direct:report").toD("${properties:report.api}/${properties:report.1.endpoint}")
      .split(jsonpath("$.sectionList[0].items[*]"),new GroupedBodyAggregationStrategy())
        .marshal().json()
        .unmarshal(df)
        .convertBodyTo(CannonicalReport.class)
      .end()
      .marshal().json()
      .setHeader(Exchange.FILE_NAME, simple("${properties:report.1.output.file}"))
      .toD("file://${properties:report.output.folder}");

Is there a way to accomplish this within the route itself, instead of having the callee invoke the route multiple times by passing in the url of the endpoint each time?

Most likely you're looking for Recipient List . You have to use custom aggregation strategy if you need to process all the responses.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM