Closed Serkan80 closed 1 week ago
Is there a way to overcome this problem ?
Write a Processor
class as a CDI bean and annotate the process method with ActivateRequestContext
. E.g:
@Singleton
public class SubscriptionChecker implements Processor {
@ActivateRequestContext
@Override
public void process(Exchange exchange) throws Exception {
// Your Panache calls here
}
}
Then in the RouteBuilder
class:
@Inject
SubscriptionChecker subscriptionChecker;
public void configure() {
// Route config here...
.process(subscriptionChecker)
}
It should work in a simlar way using named beans. The important part is that whatever you use for .bean()
or .process()
has to be a CDI bean.
@jamesnetherton, thx your tip worked.
Maybe this should be documented somewhere, otherwise it is quite confusing to assume that all injections just work on RouteBuilders when they are annotated with @ApplicationScoped
and @ActivateRequestContext
.
Maybe this should be documented somewhere
I will try to add something.
Added some notes to the CDI docs here:
Bug description
I want to retrieve data via
MyEntity
which extends Quarkus' PanacheEntity, however this doesn't work and I get the following exception:Also adding
@Transactional
and@ActivateRequestContext
on theEndpointRouteBuilder
class doesn't work.This is my code:
Is there a way to overcome this problem ?