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 2022/09/02 11:19:00 UTC

[jira] [Resolved] (CAMEL-12910) java-dsl - Add support for method references bean::methodName

     [ https://issues.apache.org/jira/browse/CAMEL-12910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-12910.
---------------------------------
    Resolution: Duplicate

> java-dsl - Add support for method references bean::methodName
> -------------------------------------------------------------
>
>                 Key: CAMEL-12910
>                 URL: https://issues.apache.org/jira/browse/CAMEL-12910
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>            Reporter: Cristian Donoiu
>            Priority: Major
>              Labels: gsoc2020
>             Fix For: 3.x
>
>         Attachments: Bean.java
>
>
> Hi
> This is not related only to spring integration.
> I like to be able to use a spring service annotated class or bean directly from route but without using the method name as string, i.e. .bean(instance, "<method name") and instead use a method reference: .bean(instance::method)
> But why?: 
> *1.* not being able to navigate quickly(open) that method from the IDE. Need to do some intermediary steps to reach that method.
> *2.* using of reflection internally by Camel to call that method.
> *3.* not being able to rename the method without breaking the route.
> *4.* not being able to see quickly (Alt+F7) who calls a methods in the IDE.
> *5.* using strings to reference a method when we have method references seems *not right.*
> As a workaround I had to add a helper class to simulate passing of method references and then internally to translate to method.
> In case it helps explaining I am attaching the helper Bean.java class (you can use it for free or to do better).
> You can use the class in any route like this: 
> from (X)
>  .bean(*call*(cancelSubscriptionService::buildSalesforceCase))
>  .to(Y)
>  .routeId(Z);
> As you see I am forced to use the intermediary helper 'call' in order to translate to an Expression.
> I would like to not have to use my helper and have the support built directly into Camel if possible. Let me know if there is a better solution to my problem.
> Thanks



--
This message was sent by Atlassian Jira
(v8.20.10#820010)