You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2020/07/06 06:10:04 UTC
[GitHub] [camel-quarkus] Namphibian opened a new issue #1459: @Handler on Bean does not resolve method
Namphibian opened a new issue #1459:
URL: https://github.com/apache/camel-quarkus/issues/1459
Hi Team.
Busy working on another example and came across the following error when using the ```@Handler``` on a bean.
Route below:
```
@Override
public void configure() throws Exception {
camelContext.setMessageHistory(true);
fromF("timer:foo?period=%s", period)
.to("bean:greeterBean")
.to("log:example");
}
```
The bean definition:
```
@ApplicationScoped
@Named("greeterBean")
@RegisterForReflection
public class Greeter {
public String greet(Exchange exchange) {
return "greet hello world";
}
@Handler
public String say(Exchange exchange) {
return "say hello world";
}
}
```
The following exception is thrown.
```
org.apache.camel.component.bean.AmbiguousMethodCallException: Ambiguous method invocations possible: [public java.lang.String org.acme.sedaInterceptLog.Greeter_ClientProxy.greet(org.apache.camel.Exchange), public java.lang.String org.acme.sedaInterceptLog.Greeter_ClientProxy.say(org.apache.camel.Exchange)] on the exchange: Exchange[]
at org.apache.camel.component.bean.BeanInfo.chooseMethod(BeanInfo.java:614)
```
Seems like ```@Handler``` is ignored completely.
If I change the bean definition to:
```
@ApplicationScoped
@Named("greeterBean")
@RegisterForReflection
public class Greeter {
@Handler
public String say() {
return "say hello world";
}
}
```
I get the following exception:
```
Caused by: [java.lang.IllegalStateException - No method invocation could be created, no matching method could be found on: org.acme.sedaInterceptLog.Greeter@946f731]
```
Is the ```@Handler``` annotation going to be used going forward? I can get the example to work just wondering about the annotations going forward.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] gnodet commented on issue #1459: @Handler on Bean does not resolve method
Posted by GitBox <gi...@apache.org>.
gnodet commented on issue #1459:
URL: https://github.com/apache/camel-quarkus/issues/1459#issuecomment-655823867
> cool, mind backporting to 3.4.x ?
Done
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] Namphibian commented on issue #1459: @Handler on Bean does not resolve method
Posted by GitBox <gi...@apache.org>.
Namphibian commented on issue #1459:
URL: https://github.com/apache/camel-quarkus/issues/1459#issuecomment-654523913
Hi Team.
I can get it to work by changing the method to:
```
public class Greeter {
public String say(Exchange exchange) {
return "say hello world";
}
}
```
However the ```@Handler``` is definitely buggy as the following code **wont work:**
```
@Handler
public String say() {
return "say hello world";
}
```
Seems like _method selection is working based on the parameters passed_ to methods. If there is no parameters it should use the ```@Handler``` to select the method. Specifying the bean method in the bean Uri like this ```to('bean:greeter?method=say')```also works.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] Namphibian edited a comment on issue #1459: @Handler on Bean does not resolve method
Posted by GitBox <gi...@apache.org>.
Namphibian edited a comment on issue #1459:
URL: https://github.com/apache/camel-quarkus/issues/1459#issuecomment-664745849
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] lburgazzoli commented on issue #1459: @Handler on Bean does not resolve method
Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on issue #1459:
URL: https://github.com/apache/camel-quarkus/issues/1459#issuecomment-654046132
We need to make it working, I guess the issue is because the of the proxy generated by ArC.
I think you can make it working by removing the CDI annotations and by binding the bean to the the context like with a static method on your route builder class:, something like:
```java
@BindToRegistry
public static Greeter greeterBean() {
return new Greeter();
}
```
In the meantime we’ll investigate the issue with the `@Handler` annotation
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] lburgazzoli commented on issue #1459: @Handler on Bean does not resolve method
Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on issue #1459:
URL: https://github.com/apache/camel-quarkus/issues/1459#issuecomment-655710484
cool, mind backporting to 3.4.x ?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] lburgazzoli commented on issue #1459: @Handler on Bean does not resolve method
Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on issue #1459:
URL: https://github.com/apache/camel-quarkus/issues/1459#issuecomment-655950502
@Namphibian you said that the workaround I provided with the `@BindToRegistry` does not work so it would be nice to have a reproducer for that.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] Namphibian commented on issue #1459: @Handler on Bean does not resolve method
Posted by GitBox <gi...@apache.org>.
Namphibian commented on issue #1459:
URL: https://github.com/apache/camel-quarkus/issues/1459#issuecomment-655814641
@lburgazzoli
Apologies I had a production issue yesterday and was stuck on that till early this morning. Do you still need a reproducer for the issue?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] gnodet edited a comment on issue #1459: @Handler on Bean does not resolve method
Posted by GitBox <gi...@apache.org>.
gnodet edited a comment on issue #1459:
URL: https://github.com/apache/camel-quarkus/issues/1459#issuecomment-655709065
The PR https://github.com/apache/camel/pull/3980 seems to fix the test @lburgazzoli , so I'll go ahead and commit the fix in camel.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] gnodet commented on issue #1459: @Handler on Bean does not resolve method
Posted by GitBox <gi...@apache.org>.
gnodet commented on issue #1459:
URL: https://github.com/apache/camel-quarkus/issues/1459#issuecomment-655709065
The PR https://github.com/apache/camel-quarkus/issues/1459 seems to fix the test @lburgazzoli , so I'll go ahead and commit the fix in camel.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] lburgazzoli closed issue #1459: @Handler on Bean does not resolve method
Posted by GitBox <gi...@apache.org>.
lburgazzoli closed issue #1459:
URL: https://github.com/apache/camel-quarkus/issues/1459
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] lburgazzoli commented on issue #1459: @Handler on Bean does not resolve method
Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on issue #1459:
URL: https://github.com/apache/camel-quarkus/issues/1459#issuecomment-654878656
@Namphibian the issue is cause by the Greeter bean to be a proxy to the real bean and the annotations are lost, whilse I'm looking on how to solve the issue, do you mind having a look at https://github.com/apache/camel-quarkus/pull/1461 and see if using @BindToRegistry works for you ?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] lburgazzoli commented on issue #1459: @Handler on Bean does not resolve method
Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on issue #1459:
URL: https://github.com/apache/camel-quarkus/issues/1459#issuecomment-655499137
@gnodet I've created a reproducer here: https://github.com/apache/camel-quarkus/pull/1465
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] lburgazzoli commented on issue #1459: @Handler on Bean does not resolve method
Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on issue #1459:
URL: https://github.com/apache/camel-quarkus/issues/1459#issuecomment-654939420
Raised an issue on on Camel: https://issues.apache.org/jira/browse/CAMEL-15278
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] Namphibian commented on issue #1459: @Handler on Bean does not resolve method
Posted by GitBox <gi...@apache.org>.
Namphibian commented on issue #1459:
URL: https://github.com/apache/camel-quarkus/issues/1459#issuecomment-655200722
Hey @lburgazzoli
I have tried using the static binding method as you have detailed in the open pull [1461](https://github.com/apache/camel-quarkus/pull/1461 ) however this is not working on my side.
I am getting the following exception:
```Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: bean://withHandler due to: No bean could be found in the registry for: withHandler```
I try and reproduce with your example later today but in my example it is not working at the moment.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] Namphibian commented on issue #1459: @Handler on Bean does not resolve method
Posted by GitBox <gi...@apache.org>.
Namphibian commented on issue #1459:
URL: https://github.com/apache/camel-quarkus/issues/1459#issuecomment-664745849
Hey Team.
Had some resourcing issues due to Covid thus only catching up now. Do you need a reproducer still? I am going to produce some more examples for the repo shortly.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] gnodet commented on issue #1459: @Handler on Bean does not resolve method
Posted by GitBox <gi...@apache.org>.
gnodet commented on issue #1459:
URL: https://github.com/apache/camel-quarkus/issues/1459#issuecomment-655495651
I've created https://github.com/apache/camel-quarkus/issues/1459 as a fix but a reproducer would be handy to make sure the synthetic flag is correctly set on the proxy class.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] lburgazzoli edited a comment on issue #1459: @Handler on Bean does not resolve method
Posted by GitBox <gi...@apache.org>.
lburgazzoli edited a comment on issue #1459:
URL: https://github.com/apache/camel-quarkus/issues/1459#issuecomment-654878656
@Namphibian the issue is cause by the `Greeter` bean to be a proxy to the real bean and the annotations are lost.
while I'm looking on how to solve the issue, do you mind having a look at https://github.com/apache/camel-quarkus/pull/1461 and see if using `@BindToRegistry` works for you ?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] lburgazzoli commented on issue #1459: @Handler on Bean does not resolve method
Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on issue #1459:
URL: https://github.com/apache/camel-quarkus/issues/1459#issuecomment-655311579
@Namphibian can you please provide a reproducer ?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org