Cristian Donoiu created CAMEL-12910:
---------------------------------------

             Summary: 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-spring-integration
            Reporter: Cristian Donoiu
         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
(v7.6.3#76005)

Reply via email to