On Wed, Dec 14, 2011 at 4:41 PM, Craig McDaniel <cpmcdan...@gmail.com> wrote:
>
> Claus Ibsen-2 wrote
>>
>> On Mon, Dec 12, 2011 at 5:53 PM, Craig McDaniel &lt;cpmcdaniel@&gt; wrote:
>>> I guess I should clarify that I'm getting an
>>> AmbiguousMethodCallException,
>>> not that the bean binding can't see the method.
>>>
>>
>> We can use help on the Scala DSL. Maybe we could add a method so you
>> can invoke a bean from the Scala predicates.
>>
>> However can you just do as in Java DSL
>>
>> when().method("myBean") instead?
>>
>
> The only way I can figure to do this is to make this one whole route a Java
> DSL route by using the inherited "builder" reference to the underlying Java
> RouteBuilder. It looks like this:
>
> builder.from("quartz://feeds/carbon?cron=0+00+8+?+*+2-6")
>      .choice.when.method("myBean", "myMethod").to("mock:end")
>
> - or -
>
> builder.from("quartz://feeds/carbon?cron=0+00+8+?+*+2-6")
>      .choice.when(builder.beanRef("myBean", "myMethod")).to("mock:end")
>
> The latter is more semantically similar to what I was trying to do.
>
> It looks rather simple to add this to the Scala DSL, so I think I'll take a
> stab at it. The DSL will look something like this:
>
> when (_.bean("myBean", "myMethod")) { ... }
> when (_.bean(myClass, "myMethod")) { ... }
> when (_.bean(myObj, "myMethod")) { ... }
>
> I think we should also add these to the DSL trait so the same pattern can be
> used by all of the *Definition wrappers. So something like this would also
> be supported:
>
> "direct:foo" bean("myBean", "myMethod")
>

Craig, great idea.

Please give it a go. We love contributions.
And create a JIRA ticket so we wont forget.

The Scala DSL could use a little love here and there, to make it more
powerful as you would expect from the combination of Scala + Camel.

> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Scala-DSL-Calling-Spring-beans-as-predicates-tp5068888p5074843.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to