camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Pierre Bergamin <ja...@ractive.ch>
Subject Re: Intercept send to beanRef endpoint
Date Thu, 05 May 2011 10:23:06 GMT
Ok that sounds reasonable, but...

The testBean in the following routes simply appends "foo" to the message 
and returns it. The following three routes do exactly the same:

from("direct:in").to("bean:testBean"); // bean is endpoint
from("direct:in").to("testBean"); // bean is endpoint
from("direct:in").beanRef("testBean"); // bean is processor

So is there anything to be considered when chosing one of the three 
versions? Or is there no practical difference if a bean is just a 
processor or if it is an endpoint that invokes a processor.


Best regards,
James


Am 05.05.2011 11:31, schrieb Romain Manni-Bucau:
> in one case you send your exchange to an endpoint which sends it to a
> processor. In the other case (beanRef) you send it directly to the
> processor.
>
> - Romain
>
> 2011/5/5 Jean-Pierre Bergamin<james@ractive.ch>:
>> Am 05.05.2011 09:34, schrieb Claus Ibsen:
>>> On Thu, May 5, 2011 at 9:19 AM, Jean-Pierre Bergamin<james@ractive.ch>
>>>   wrote:
>>>> Hello camel users
>>>>
>>>> We are trying to intercept calls from being sent to a bean endpoint in a
>>>> route that is declared as:
>>>>   from("...").beanRef("myBean", "myMethod")
>>>>
>>>> The interception is declared as
>>>> interceptSendToEndpoint("bean:myBean?method=myMethod"), but calls to
>>>> myBean
>>>> are not intercepted. When changing the route to
>>>>   from("...").to("bean:myBean?method=myMethod")
>>>> the interception works.
>>>>
>>>> Is there a way to use interceptSendToEndpoint together with beanRef()
>>>> instead of "bean:myBean..."?
>>> No. The beanRef is not an endpoint.
>>> But maybe under the hood we can change that in camel-core so a beanRef
>>> is a facade for sending a message to an endpoint.
>>> Then the interceptor should work.
>> Ok. It seems as if I then don't understand bean refs then. What is the
>> difference between .to("bean:myBean?method=myMethod") and .beanRef("myBean",
>> "myMethod")? When the beanRef is at the end of a route and returns
>> something, then the effect is the same, isn't it?
>>
>> Best regards,
>> James
>>


Mime
View raw message