Interfaced
Interfaced

Reputation: 124

Dynamic from(URI) in Camel

I would like to create the from(URI) at runtime. I am using the twitter-component to fetch the tweets of the timeline of a user. The username of the user i would like to get from the body of the incoming message.

from("direct:twitterinternal")   // body contains username as string
    .from("twitter://timeline/user?type=direct&user=" + "${body}")

Does camel offer the possibility to create URIs at runtime?

Upvotes: 3

Views: 4712

Answers (2)

rapt
rapt

Reputation: 12220

Camel 2.16 or higher? Try toD.

http://camel.apache.org/message-endpoint.html

Upvotes: -1

Ben ODay
Ben ODay

Reputation: 21005

I generally use the recipientList pattern and the simple expression language for dynamic producer routes...

from("direct:twitterinternal")
    .recipientList(simple("twitter://timeline/user?type=direct&user=" + "${body}"))

otherwise, for dynamic consuming, you have 2 options:

Upvotes: 2

Related Questions