Hi Jothi,

A direct: endpoint provides a synchronous, in memory call which is probably the simplest, most basic way in which two endpoints could communicate. In real life endpoints almost never share the memory space, right? So the answer to your question revolves around those usecases where the two endpoints share the memory space.

One is, like you mentioned, kinda artificially splitting a route in two and use a direct endpoint to connect them, sorta like using continuations. It allows for separation of routes into parts that have different roles and make them easier to manage.

There is a second probably even more interesting set of usecases, mostly useful during development/testing in different test environments, where you would use a direct endpoint (and a route) to mock an external service not available in that particular environment. Mocking it out, allows you to continue your integration work with minimal impact. Things are even easier if you externalize your uris using things like the properties component, because then the only thing that changes is a string in a text file.

And there are obviously others, unit testing was mentioned.

I hope this helps,
Hadrian




On 02/04/2013 04:42 PM, Joe San wrote:
Camel users,

I came across the direct component. As I understand that this component is
used to tie routes together in the same camel context, I'm not able to
think of any practical use cases. Could anyone please let me know of a
practical example where the direct component would be a good fit?

Regards,
Jothi

Reply via email to