user1838538
user1838538

Reputation: 11

Apache camel multicast FreeMarker

I need to send two different XMLs (by FreeMarker) to two different endpoints. i.e.

.to("freemarker:templates/xml1.ftl").to("file://C:\\testXmls1")

and

.to("freemarker:templates/xml2.ftl").to("file://C:\\testXmls2")

I had a look at the multicast() function but I don't know how to apply it when there are two .to

Could anyone please help me?

Upvotes: 1

Views: 651

Answers (1)

Claus Ibsen
Claus Ibsen

Reputation: 55585

Yes you can specify multiple endpoints in the same .to(uri1, uri2, ...) then it becomes as a single "eip".

multicast()
  .to(uri1a, uri1b)
  .to(uri2a, uri2b)
.end() // to end multicast

Otherwise you would have to enclose it using the pipeline eip.

multicast()
  .pipeline().to(uri1a).to(uri1b).end() // to end this pipeline
  .pipeline().to(uri2a).to(uri2b).end() // to end this pipeline
.end() // to end multicast

Upvotes: 2

Related Questions