You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2014/09/13 07:41:34 UTC

[jira] [Commented] (CAMEL-7811) Does every route that starts with the Direct component have its own thread?

    [ https://issues.apache.org/jira/browse/CAMEL-7811?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14132557#comment-14132557 ] 

Claus Ibsen commented on CAMEL-7811:
------------------------------------

And btw you are wrong, direct does not have its own thread, it uses the caller thread, just like a direct method invocation in Java does - hence the name.

> Does every route that starts with the Direct component have its own thread?
> ---------------------------------------------------------------------------
>
>                 Key: CAMEL-7811
>                 URL: https://issues.apache.org/jira/browse/CAMEL-7811
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>            Reporter: Camel Guy
>            Priority: Minor
>
> Computing environments must promote decomposition if they are to withstand the ravages of time. It is very convenient in Camel to define routes as subroutines. As a particular route becomes reused often, and is even copy and pasted across camel projects (this happens especially when Spring DSL is used), perhaps the functionality should be refactored into a Java class (easy) or a Camel component (harder). But that is a different topic. Sometimes route reuse is preferred.
> Again, routes are very convenient for encapsulating arbitrarily complex logic. However, the downside to factoring a Camel program into reusable routes is that it appears that one Java thread is dedicated to every route, even when they start with the "Direct" component, which is commonly advertised in Camel literature as being the most efficient way for a route to invoke another.
> If it is true that every route that starts with the Direct component has its own thread, then these routes consume thread resources and are also expensive to invoke because calling across thread boundaries ultimately requires some form of synchronization.
> I may be missing an important aspect of Camel messaging, such as in vs. in/out. I would like see Camel's architects discuss this topic so that I can learn the best way to build complex Camel programs. I wonder if the Direct component could be changed some day to merely be called in-thread without the additional overhead.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)