camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <>
Subject [jira] Updated: (CAMEL-2368) Bean Expression for Non Registry beans can't reference an instance
Date Sat, 16 Jan 2010 13:02:43 GMT


Claus Ibsen updated CAMEL-2368:

    Issue Type: Improvement  (was: Bug)

Its not a bug but a request for an improvement

> Bean Expression for Non Registry beans can't reference an instance
> ------------------------------------------------------------------
>                 Key: CAMEL-2368
>                 URL:
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.0.0, 2.1.0
>         Environment: Compile issue.  Java 6, Windows, Eclipse/Gallileo
>            Reporter: Michael Mathers
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.2.0
> The documentation at the bottom of this page:
says that I can use the bean expression DSL to work with beans that are not in the registry
in two different ways (2.0-M2+).
> # Specify Class/method and Camel will create a new instance of the bean and call the
> #  Specify instance/method and Camel will use the the specified instance and call the
> In fact, the doc shows examples of both:
> h4. Method 1)
> {code}
>         from("activemq:topic:OrdersTopic").
>                 filter().expression(bean(MyBean.class, "isGoldCustomer")).
>                 to("activemq:BigSpendersQueue");
> {code}
> h4. Method 2)
> {code}
>    private MyBean my;
>         from("activemq:topic:OrdersTopic").
>                 filter().expression(bean(my, "isGoldCustomer")).
>                 to("activemq:BigSpendersQueue");
> {code}
> I am unable to do the latter (#2) as the methods are not defined.  I'm using Camel 2.1.0
but I've tried 2.0.0 as well. So either the doc is wrong or the methods are missing/not visible.
My code specifically is:
> {code}
> private Object list;
> ...
> from (getErrorEndpoint())
>         .recipientList(list, "getRecipients");
> {code}
> Yes, there are easy ways to avoid this.  But I prefer not to have to create more XML
and/or specify a Class name here.
> Finally, is there a good reason ".recipientList()" isn't overloaded to take an Endpoint[]
instead of only an Expression?   The @RecipientList annotation seems to anticipate this form
but there doesn't seem to be a good way to plug the @RecipientList annotated bean into the
route definition.  Even if the bean is in the registry it looks as if you still have to supply
the method name anyway despite that its already annotated (unless you also annotate with @Handler
which might be undesirable). 
> Ideally, I could have...
> {code}
> Object list = new Object() {
>    @RecipientList public Collection<Endpoint> getRecipents(Object body) {... }
> }
> ...
> from (endpoint).recipientList(<any instance annotated with @RecipientList>)
> {code}
> or even
> {code}
> // Look for method "errors" then look for annotation @RecipientList("errors")
> from (endpoint).recipientList( bean, "errors" )
> {code}
> Is this making any sense?  (I'm still very wet behind the ears)

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message