You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In an application that uses SmallRye Reactive Messaging, a channel consuming method may affect the contexts propagated to it using the @CurrentThreadContext annotation. However, when the channel consuming method is also annotated with @Blocking, the configuration in the @CurrentThreadContext annotation seems to be ignored.
@Path("/hello")
classGreetingResource {
@Channel("greeting")
Emitter<String> emitter;
@POST@Consumes(MediaType.TEXT_PLAIN)
publicvoidhello(Stringbody) {
emitter.send(body);
}
}
classGreetingProcessor {
@InjectRequestContextControllercontroller;
@InjectLoggerlogger;
@Blocking// CDI context is not cleared for blocking methods, removing this annotation avoids the IllegalStateException@CurrentThreadContext(cleared = ThreadContext.CDI)
@Incoming("greeting")
voidprocess(Stringname) {
if (!controller.activate()) {
thrownewIllegalStateException("Request context is already active");
}
Expected behavior
The current context in the channel consuming method should be affected by the @CurrentThreadContext annotation.
Actual behavior
The context is propagated to the channel consuming method as if the @CurrentThreadContext annotation were not present.
How to Reproduce?
Small example application attached.
Run the test and note that SmallRye Reactive Messaging logs that the process method throws the IllegalStateException that indicates the request context is active.
Remove the @Blocking annotations from the process method.
Re-run the test and note that no IllegalStateException is logged, because the CDI context has been cleared, so the RequestContextController reference in process may create a new request scope.
Darwin pixee-mbp-gilday.localdomain 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000 arm64
Output of java -version
openjdk version "21.0.1" 2023-10-17 LTS OpenJDK Runtime Environment Temurin-21.0.1+12 (build 21.0.1+12-LTS) OpenJDK 64-Bit Server VM Temurin-21.0.1+12 (build 21.0.1+12-LTS, mixed mode)
Quarkus version or git rev
3.10.0
Build tool (ie. output of mvnw --version or gradlew --version)
Describe the bug
In an application that uses SmallRye Reactive Messaging, a channel consuming method may affect the contexts propagated to it using the
@CurrentThreadContext
annotation. However, when the channel consuming method is also annotated with@Blocking
, the configuration in the@CurrentThreadContext
annotation seems to be ignored.Expected behavior
The current context in the channel consuming method should be affected by the
@CurrentThreadContext
annotation.Actual behavior
The context is propagated to the channel consuming method as if the
@CurrentThreadContext
annotation were not present.How to Reproduce?
Small example application attached.
process
method throws theIllegalStateException
that indicates the request context is active.@Blocking
annotations from theprocess
method.IllegalStateException
is logged, because the CDI context has been cleared, so theRequestContextController
reference inprocess
may create a new request scope.quarkus-emitter-new-request-context.zip
Output of
uname -a
orver
Darwin pixee-mbp-gilday.localdomain 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000 arm64
Output of
java -version
openjdk version "21.0.1" 2023-10-17 LTS OpenJDK Runtime Environment Temurin-21.0.1+12 (build 21.0.1+12-LTS) OpenJDK 64-Bit Server VM Temurin-21.0.1+12 (build 21.0.1+12-LTS, mixed mode)
Quarkus version or git rev
3.10.0
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae) Maven home: /Users/jgilday/.m2/wrapper/dists/apache-maven-3.9.6-bin/3311e1d4/apache-maven-3.9.6 Java version: 21.0.1, vendor: Eclipse Adoptium, runtime: /Library/Java/JavaVirtualMachines/temurin-21.jdk/Contents/Home Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "14.4.1", arch: "aarch64", family: "mac"
Additional information
No response
The text was updated successfully, but these errors were encountered: