You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Christopher Hammack <ch...@fadedsky.com> on 2009/07/07 00:41:31 UTC
Cross-context "direct" component?
Hi....
Are there any plans to add a "direct" component that works across camel
contexts (e.g. similiar to vm:// vs seda://)?
Using the same model as to how vm:// works (using a static to store the
consumers), I was able to do this some time ago against 1.x, and it has
worked well for us. Seems like it would be nice to have the capabilities of
the synchronous and asynchronous components be symmetrical.
Thanks
--
View this message in context: http://www.nabble.com/Cross-context-%22direct%22-component--tp24364075p24364075.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Cross-context "direct" component?
Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Jul 7, 2009 at 6:00 PM, Christopher
Hammack<ch...@fadedsky.com> wrote:
>
> Hi Claus,
>
> Thanks for taking the time to reply.
Hi
Feel free to create a JIRA ticket for your request. And as you know we
love contributions so if you got the skills to look into the code you
got the skills to try attempt a patch with a new component? Maybe it
could be named: directvm
>
> I just took a look at the code on the trunk. Unfortunately, the seda with
> waitForTaskToComplete is not equivalent to what I described earlier. The
> seda endpoint is still performing polling, acting on a separate thread for
> the second route. The overhead of having one thread blocking while waiting
> on the other to complete is really undesirable for performance. I also
> noticed there appears to be a hardcoded 1 second poll for seda endpoints, is
> that correct? (If true, that is also highly undesirable).
>
> Consider the number of threads that would be required if there were multiple
> routes that forwarded to a common route, to avoid blocking):
>
> [Route 1: 3 Threads] --(seda)--> [Route 2: 3 Threads]
> [Route 3: 2 Threads] --(seda)--> [Route 2: 2 Threads]
>
> Effectively, to avoid blocking of the first routes (1 and 3), there has to
> be one consumer for each potential number of producers.
>
> In the direct endpoint, the execution continues on in the current thread,
> without any polling or need for an additional processing thread. I merely
> extended it so that it would work across camel contexts.
>
> Let me know if this explains what we're looking for a bit better, or if any
> of my interpretations of the code are incorrect. Thanks
>
>
>
>
> Claus Ibsen-2 wrote:
>>
>> On Tue, Jul 7, 2009 at 4:30 PM, Christopher
>> Hammack<ch...@fadedsky.com> wrote:
>>>
>>> How does it determine whether synchronous or asynchronous is appropriate?
>>>
>>> Example, given these routes:
>>>
>>> <route>
>>> <from uri="vm:stage2"/>
>>> <to uri="bean:fooBean"/>
>>> </route>
>>>
>>> <route>
>>> <from uri="activemq:my.queue"/>
>>> <to uri="bean:barBean"/>
>>> <to uri="vm:stage2"/>
>>> </route>
>>>
>>> The behavior I want is that barBean is executed, then in the same thread,
>>> synchronously, I want fooBean to be executed. Essentially "stage2" is a
>>> macro that can be reused in many routes, across contexts. How do I know
>>> for
>>> sure that it is going to execute synchronously?
>>
>> We are still talking about 1 route is running in CamelContext A
>> and route 2 is running in CamelContext B
>>
>> By default the vm/seda will look at the exchange pattern. If its OUT
>> capable then it will wait.
>> Otherwise not.
>>
>> But you can control this behavior with waitForTaskToComplete
>>
>> See seda, this also applies for vm:
>> http://camel.apache.org/seda.html
>>
>>
>>>
>>>
>>>
>>>
>>> Claus Ibsen-2 wrote:
>>>>
>>>> On Tue, Jul 7, 2009 at 12:41 AM, Christopher
>>>> Hammack<ch...@fadedsky.com> wrote:
>>>>>
>>>>> Hi....
>>>>>
>>>>> Are there any plans to add a "direct" component that works across camel
>>>>> contexts (e.g. similiar to vm:// vs seda://)?
>>>> You can use the vm for that in 2.0m2+ as it will wait for reply, eg
>>>> being synchronous when needed.
>>>>
>>>>
>>>>>
>>>>> Using the same model as to how vm:// works (using a static to store the
>>>>> consumers), I was able to do this some time ago against 1.x, and it has
>>>>> worked well for us. Seems like it would be nice to have the
>>>>> capabilities
>>>>> of
>>>>> the synchronous and asynchronous components be symmetrical.
>>>>>
>>>>> Thanks
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/Cross-context-%22direct%22-component--tp24364075p24364075.html
>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Claus Ibsen
>>>> Apache Camel Committer
>>>>
>>>> Open Source Integration: http://fusesource.com
>>>> Blog: http://davsclaus.blogspot.com/
>>>> Twitter: http://twitter.com/davsclaus
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Cross-context-%22direct%22-component--tp24364075p24374329.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Cross-context-%22direct%22-component--tp24364075p24376160.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
--
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Re: Cross-context "direct" component?
Posted by Christopher Hammack <ch...@fadedsky.com>.
Hi Claus,
Thanks for taking the time to reply.
I just took a look at the code on the trunk. Unfortunately, the seda with
waitForTaskToComplete is not equivalent to what I described earlier. The
seda endpoint is still performing polling, acting on a separate thread for
the second route. The overhead of having one thread blocking while waiting
on the other to complete is really undesirable for performance. I also
noticed there appears to be a hardcoded 1 second poll for seda endpoints, is
that correct? (If true, that is also highly undesirable).
Consider the number of threads that would be required if there were multiple
routes that forwarded to a common route, to avoid blocking):
[Route 1: 3 Threads] --(seda)--> [Route 2: 3 Threads]
[Route 3: 2 Threads] --(seda)--> [Route 2: 2 Threads]
Effectively, to avoid blocking of the first routes (1 and 3), there has to
be one consumer for each potential number of producers.
In the direct endpoint, the execution continues on in the current thread,
without any polling or need for an additional processing thread. I merely
extended it so that it would work across camel contexts.
Let me know if this explains what we're looking for a bit better, or if any
of my interpretations of the code are incorrect. Thanks
Claus Ibsen-2 wrote:
>
> On Tue, Jul 7, 2009 at 4:30 PM, Christopher
> Hammack<ch...@fadedsky.com> wrote:
>>
>> How does it determine whether synchronous or asynchronous is appropriate?
>>
>> Example, given these routes:
>>
>> <route>
>> <from uri="vm:stage2"/>
>> <to uri="bean:fooBean"/>
>> </route>
>>
>> <route>
>> <from uri="activemq:my.queue"/>
>> <to uri="bean:barBean"/>
>> <to uri="vm:stage2"/>
>> </route>
>>
>> The behavior I want is that barBean is executed, then in the same thread,
>> synchronously, I want fooBean to be executed. Essentially "stage2" is a
>> macro that can be reused in many routes, across contexts. How do I know
>> for
>> sure that it is going to execute synchronously?
>
> We are still talking about 1 route is running in CamelContext A
> and route 2 is running in CamelContext B
>
> By default the vm/seda will look at the exchange pattern. If its OUT
> capable then it will wait.
> Otherwise not.
>
> But you can control this behavior with waitForTaskToComplete
>
> See seda, this also applies for vm:
> http://camel.apache.org/seda.html
>
>
>>
>>
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> On Tue, Jul 7, 2009 at 12:41 AM, Christopher
>>> Hammack<ch...@fadedsky.com> wrote:
>>>>
>>>> Hi....
>>>>
>>>> Are there any plans to add a "direct" component that works across camel
>>>> contexts (e.g. similiar to vm:// vs seda://)?
>>> You can use the vm for that in 2.0m2+ as it will wait for reply, eg
>>> being synchronous when needed.
>>>
>>>
>>>>
>>>> Using the same model as to how vm:// works (using a static to store the
>>>> consumers), I was able to do this some time ago against 1.x, and it has
>>>> worked well for us. Seems like it would be nice to have the
>>>> capabilities
>>>> of
>>>> the synchronous and asynchronous components be symmetrical.
>>>>
>>>> Thanks
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Cross-context-%22direct%22-component--tp24364075p24364075.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Cross-context-%22direct%22-component--tp24364075p24374329.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>
>
--
View this message in context: http://www.nabble.com/Cross-context-%22direct%22-component--tp24364075p24376160.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Cross-context "direct" component?
Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Jul 7, 2009 at 4:30 PM, Christopher
Hammack<ch...@fadedsky.com> wrote:
>
> How does it determine whether synchronous or asynchronous is appropriate?
>
> Example, given these routes:
>
> <route>
> <from uri="vm:stage2"/>
> <to uri="bean:fooBean"/>
> </route>
>
> <route>
> <from uri="activemq:my.queue"/>
> <to uri="bean:barBean"/>
> <to uri="vm:stage2"/>
> </route>
>
> The behavior I want is that barBean is executed, then in the same thread,
> synchronously, I want fooBean to be executed. Essentially "stage2" is a
> macro that can be reused in many routes, across contexts. How do I know for
> sure that it is going to execute synchronously?
We are still talking about 1 route is running in CamelContext A
and route 2 is running in CamelContext B
By default the vm/seda will look at the exchange pattern. If its OUT
capable then it will wait.
Otherwise not.
But you can control this behavior with waitForTaskToComplete
See seda, this also applies for vm:
http://camel.apache.org/seda.html
>
>
>
>
> Claus Ibsen-2 wrote:
>>
>> On Tue, Jul 7, 2009 at 12:41 AM, Christopher
>> Hammack<ch...@fadedsky.com> wrote:
>>>
>>> Hi....
>>>
>>> Are there any plans to add a "direct" component that works across camel
>>> contexts (e.g. similiar to vm:// vs seda://)?
>> You can use the vm for that in 2.0m2+ as it will wait for reply, eg
>> being synchronous when needed.
>>
>>
>>>
>>> Using the same model as to how vm:// works (using a static to store the
>>> consumers), I was able to do this some time ago against 1.x, and it has
>>> worked well for us. Seems like it would be nice to have the capabilities
>>> of
>>> the synchronous and asynchronous components be symmetrical.
>>>
>>> Thanks
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Cross-context-%22direct%22-component--tp24364075p24364075.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Cross-context-%22direct%22-component--tp24364075p24374329.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
--
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Re: Cross-context "direct" component?
Posted by Christopher Hammack <ch...@fadedsky.com>.
How does it determine whether synchronous or asynchronous is appropriate?
Example, given these routes:
<route>
<from uri="vm:stage2"/>
<to uri="bean:fooBean"/>
</route>
<route>
<from uri="activemq:my.queue"/>
<to uri="bean:barBean"/>
<to uri="vm:stage2"/>
</route>
The behavior I want is that barBean is executed, then in the same thread,
synchronously, I want fooBean to be executed. Essentially "stage2" is a
macro that can be reused in many routes, across contexts. How do I know for
sure that it is going to execute synchronously?
Claus Ibsen-2 wrote:
>
> On Tue, Jul 7, 2009 at 12:41 AM, Christopher
> Hammack<ch...@fadedsky.com> wrote:
>>
>> Hi....
>>
>> Are there any plans to add a "direct" component that works across camel
>> contexts (e.g. similiar to vm:// vs seda://)?
> You can use the vm for that in 2.0m2+ as it will wait for reply, eg
> being synchronous when needed.
>
>
>>
>> Using the same model as to how vm:// works (using a static to store the
>> consumers), I was able to do this some time ago against 1.x, and it has
>> worked well for us. Seems like it would be nice to have the capabilities
>> of
>> the synchronous and asynchronous components be symmetrical.
>>
>> Thanks
>> --
>> View this message in context:
>> http://www.nabble.com/Cross-context-%22direct%22-component--tp24364075p24364075.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>
>
--
View this message in context: http://www.nabble.com/Cross-context-%22direct%22-component--tp24364075p24374329.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Cross-context "direct" component?
Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Jul 7, 2009 at 12:41 AM, Christopher
Hammack<ch...@fadedsky.com> wrote:
>
> Hi....
>
> Are there any plans to add a "direct" component that works across camel
> contexts (e.g. similiar to vm:// vs seda://)?
You can use the vm for that in 2.0m2+ as it will wait for reply, eg
being synchronous when needed.
>
> Using the same model as to how vm:// works (using a static to store the
> consumers), I was able to do this some time ago against 1.x, and it has
> worked well for us. Seems like it would be nice to have the capabilities of
> the synchronous and asynchronous components be symmetrical.
>
> Thanks
> --
> View this message in context: http://www.nabble.com/Cross-context-%22direct%22-component--tp24364075p24364075.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
--
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus