KMUS edited a comment on issue #2632:
URL: https://github.com/apache/camel-quarkus/issues/2632#issuecomment-845254233
Version 1.9.0 built and included
> <dependency>
> <groupId>org.apache.camel.quarkus</groupId>
> <artifactId>camel-quarkus-direct</artifactId>
> <version>1.9.0-SNAPSHOT</version>
> </dependency>
> <dependency>
> <groupId>org.apache.camel.quarkus</groupId>
> <artifactId>camel-quarkus-bean</artifactId>
> <version>1.9.0-SNAPSHOT</version>
> </dependency>
> <dependency>
> <groupId>org.apache.camel.quarkus</groupId>
> <artifactId>camel-quarkus-file</artifactId>
> <version>1.9.0-SNAPSHOT</version>
> </dependency>
> <dependency>
> <groupId>org.apache.camel.quarkus</groupId>
> <artifactId>camel-quarkus-kafka</artifactId>
> <version>1.9.0-SNAPSHOT</version>
> </dependency>
> <dependency>
> <groupId>org.apache.camel.quarkus</groupId>
> <artifactId>camel-quarkus-timer</artifactId>
> <version>1.9.0-SNAPSHOT</version>
> </dependency>
> <dependency>
> <groupId>org.apache.camel.quarkus</groupId>
> <artifactId>camel-quarkus-rabbitmq</artifactId>
> <version>1.9.0-SNAPSHOT</version>
> </dependency>
> <dependency>
> <groupId>org.apache.camel.quarkus</groupId>
> <artifactId>camel-quarkus-reactive-streams</artifactId>
> <version>1.9.0-SNAPSHOT</version>
> </dependency>
> <dependency>
> <groupId>org.apache.camel.quarkus</groupId>
> <artifactId>camel-quarkus-log</artifactId>
> <version>1.9.0-SNAPSHOT</version>
> </dependency>
1.) The new version seems to fix that issue 'No consumers available on
endpoint' but still results in a npe. Injection works fine with @Inject on
@Produce. According to the docs, it should work without inject too.
```
@Dependent
public class CamelRunner {
@Produce("direct:runner")
ProducerTemplate producer;
```
```
java.lang.NullPointerException
at x.y.CamelRunner.run(CamelRunner.java:38)
at
x.y.CamelRunner_Subclass.run$$superaccessor1(CamelRunner_Subclass.zig:189)
at
x.y.CamelRunner_Subclass$$function$$1.apply(CamelRunner_Subclass$$function$$1.zig:29)
at
io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
at
io.quarkus.arc.runtime.devconsole.InvocationInterceptor.proceed(InvocationInterceptor.java:63)
at
io.quarkus.arc.runtime.devconsole.InvocationInterceptor.monitor(InvocationInterceptor.java:51)
at
io.quarkus.arc.runtime.devconsole.InvocationInterceptor_Bean.intercept(InvocationInterceptor_Bean.zig:521)
at
io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
at
io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
at
io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32)
at x.y.CamelRunner_Subclass.run(CamelRunner_Subclass.zig:147)
at x.y.Main.run(Main.java:25)
at x.y.Main_Subclass.run$$superaccessor2(Main_Subclass.zig:327)
at
x.y.Main_Subclass$$function$$2.apply(Main_Subclass$$function$$2.zig:29)
at
io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
at
io.quarkus.arc.runtime.devconsole.InvocationInterceptor.proceed(InvocationInterceptor.java:63)
at
io.quarkus.arc.runtime.devconsole.InvocationInterceptor.monitor(InvocationInterceptor.java:51)
at
io.quarkus.arc.runtime.devconsole.InvocationInterceptor_Bean.intercept(InvocationInterceptor_Bean.zig:521)
at
io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
at
io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
at
io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32)
at x.y.Main_Subclass.run(Main_Subclass.zig:285)
at picocli.CommandLine.executeUserObject(CommandLine.java:1939)
at picocli.CommandLine.access$1300(CommandLine.java:145)
at
picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
at
picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
at picocli.CommandLine.execute(CommandLine.java:2078)
at x.y.Main.run(Main.java:30)
at x.y.Main_Subclass.run$$superaccessor1(Main_Subclass.zig:220)
at
x.y.Main_Subclass$$function$$1.apply(Main_Subclass$$function$$1.zig:33)
at
io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
at
io.quarkus.arc.runtime.devconsole.InvocationInterceptor.proceed(InvocationInterceptor.java:63)
at
io.quarkus.arc.runtime.devconsole.InvocationInterceptor.monitor(InvocationInterceptor.java:51)
at
io.quarkus.arc.runtime.devconsole.InvocationInterceptor_Bean.intercept(InvocationInterceptor_Bean.zig:521)
at
io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
at
io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
at
io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32)
at x.y.Main_Subclass.run(Main_Subclass.zig:181)
at x.y.Main_ClientProxy.run(Main_ClientProxy.zig:158)
at
io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:122)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:66)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:42)
at x.y.Main.main(Main.java:34)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at
io.quarkus.runner.bootstrap.StartupActionImpl$3.run(StartupActionImpl.java:134)
at java.base/java.lang.Thread.run(Thread.java:834)
```
2.) Unused bean is removed during build. Adding @Unremovable will not call
onBar anymore.
```
@ApplicationScoped
public class Bar {
@Consume("direct:bar")
public void onBar(String str) {
}
}
```
```
================================================================================
CDI: programmatic lookup problem detected
-----------------------------------------
At least one bean matched the required type and qualifiers but was marked as
unused and removed during build
Removed beans:
- CLASS bean x.y.Bar [types=[class x.y.Bar],
qualifiers=[@javax.enterprise.inject.Default(), @javax.enterprise.inject.Any()]]
Required type: class x.y.Bar
Required qualifiers: []
Solutions:
- Application developers can eliminate false positives via the
@Unremovable annotation
- Extensions can eliminate false positives via build items, e.g. using
the UnremovableBeanBuildItem
- See also https://quarkus.io/guides/cdi-reference#remove_unused_beans
================================================================================
```
```
@ApplicationScoped
@Unremovable
public class Bar {
@Consume("direct:bar")
public void onBar(String str) {
}
}
@ApplicationScoped
public class MutinyTest {
@Inject
CamelContext context;
Subscriber<String> subscriber;
@PostConstruct
public void init() {
subscriber = CamelReactiveStreams.get(context)
.subscriber("direct:foo-notification", String.class);
}
@Incoming("foo-notification") // mutiny
public void consume(String notify) {
subscriber.onNext(notify);
}
}
from("direct:foo-notification").to("direct:bar");
```
--
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:
[email protected]