-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CDI with Camel K runtime 1.7. #770
Comments
CDI in camel-k does not work at the moment, i.e. it is not possible to use @Inject on a camel-k integration. |
when do you plan to add there? |
We don't have any concrete ETA at the moment, we may have a look at this when working on camel-k 2.0 but again, no concrete ETA. If you have any spare time to look at implementing it, then it would be very appreciated |
Can you please refer me to target design, current state, documentation? I'll take a look at it. What actually solved #362? |
Any update? |
@ogomezdi the plan is to work on supporting directly Camel Quarkus out of the box, hence supporting CDI and any other Camel Quarkus feature. Maybe in Camel K 2.6 or 2.7 this should be already available. Keep it tuned. |
I've seen in Camel K 2.6 there is a new feature for plain-quarkus import org.apache.camel.builder.RouteBuilder; import ca.uhn.fhir.context.FhirContext; import jakarta.enterprise.context.ApplicationScoped; @ApplicationScoped
}` |
The @Inject
@Named("R4")
FhirContext fhircontext; |
In theory everything working with plain Camel Quarkus should be working the same in Camel K with this new approach. Can you try doing exactly the same with a local execution (ie, via Camel JBang run with Quarkus runtime)? |
I've tried with Quarkus runtime, and there is working properly, let me show you output logs:
The route it's soo simple, in both cases I've used: package org.acme.osgomez; import org.apache.camel.builder.RouteBuilder; import ca.uhn.fhir.context.FhirContext; @ApplicationScoped
}
|
Yep, likely this is the reason as it may have different classloaders involved, at least in java. It would be interesting to try with other DSL such as YAML as I think in that case we'd be in a similar situation in local execution of Camel Quarkus as well. IIRC, during a build of a Java route, the class is packaged as part of the dependency, which is something not happening in Camel K. |
May be related to apache/camel-k#5539 |
Absolutely, I'll also follow this issue to see if finally we got it. |
CDI does not work with Camel K runtime 1.7. The route is deployed, but when using the injected bean I get either a "nullpointerexception" or "bean not found". I tried it on an example from your project https://github.com/apache/camel-k/tree/aff450bfcccfa35ac0496336b1ea3801e4f8118f/e2e/yaks/openshift/monitoring/app
as well as on examples that work on Camel in combination with Quarkus (quarkus Di, spring DI). I enclose in the attachment.
I ask for verification / advice. It seems like #362 issue.
Thank you.
CDI_pokus.zip
The text was updated successfully, but these errors were encountered: