richersoon
richersoon

Reputation: 4902

Camel - How to get the value from header when setting http4 endpoint?

I would like to get the value of http4 from the header but it throwing me

Failed to create route route15 at: >>> To[${header.ExternalEndPoint}]

Here is my code

.toF("http4://%s", simple("${header.ExternalEndPoint}"))

or

.toF("http4://%s", constant("${header.ExternalEndPoint}"))

It is only working when I hardcoded the value like

.toF("http4://localhost/foo");

Upvotes: 1

Views: 1475

Answers (1)

msp
msp

Reputation: 3362

Dynamic URIs in "to" are not supported prior to Camel 2.16. If you're using a version lower than 2.16 then you should use recipientList

.recipientList(simple("http4://${header.ExternalEndPoint}"))

From 2.16 onwards, toD is your friend:

.toD("http4://${header.ExternalEndPoint}")

Upvotes: 2

Related Questions