Loading repository data…
Loading repository data…
amusarra / repository
This project is a Quarkus application that shows how to build a system that is able to track JAX-RS requests coming and going from the application across different storage channels, such as a MongoDB database, SQL, or an AMQP broker using the Quarkus Event Bus.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
| Image | Latest Tag | Repository Link | Pull Command |
|---|---|---|---|
amusarra/eventbus-logging-filter-jaxrs | Docker Hub | Pull the latest AMD64 native version docker pull amusarra/eventbus-logging-filter-jaxrs:latest-amd64native | |
amusarra/eventbus-logging-filter-jaxrs | Docker Hub | Pull the latest version docker pull amusarra/eventbus-logging-filter-jaxrs:latest |
Remember that to use the podman command, you need to replace
dockerwithpodman. Also remember that the pattern for the version of the image islatestorlatest-amd64native; you can replacelatestwith the desired version:1.0.0,1.0.1, or the branch name (main, develop, etc.) For example,docker pull amusarra/eventbus-logging-filter-jaxrs:v1.2.12, referer to the release 1.2.12 of the project.
For more information about the tags available, please visit the Docker Hub repository.
| Metric | Value |
|---|---|
| Quality Gate | |
| Security | |
| Reliability | |
| Maintainability | |
| Coverage | |
| Duplications |
For more information, visit the SonarCloud Dashboard.
This project is a Quarkus application that demonstrates how to create a system capable of tracking incoming and outgoing JAX-RS requests from the application across various storage channels, such as a MongoDB database, SQL, or an AMQP broker, by leveraging Quarkus's Event Bus.
Figure 1 - Quarkus Application Flow
If you want to learn more about Quarkus, visit the official website quarkus.io. Below are the instructions for running the application in development mode and creating a native executable.
Since version 1.3.1 the JAX-RS filter has been redesigned with a capture-only + external dispatcher pattern to eliminate any impact on HTTP throughput.
Figure 2 - High-Performance Tracing Architecture
| Component | Role | Thread |
|---|---|---|
TraceJaxRsRequestResponseFilter | Captures raw data (strings/primitives) and enqueues in O(1). No JSON, no I/O, no blocking. Body reading adapts automatically to the endpoint type via readBodyAsync(): direct blocking read on worker threads; Vertx#executeBlocking() delegation on the I/O event loop thread (reactive endpoints). | Blocking endpoint: HTTP worker thread (executor-thread-*) · Reactive endpoint (Uni<Response>): I/O event loop thread (vert.x-eventloop-thread-*) |
ArrayBlockingQueue (×2) | Bounded FIFO queue (request + response). Drop-on-full backpressure: events are silently dropped with a WARN log rather than blocking the HTTP thread. | lock-free |
TraceEventDispatcher | Dedicated daemon thread (trace-event-dispatcher) that drains queues in burst mode (no sleep when items are present) and builds JsonObject + publishes to the Event Bus. Completely independent of the Quarkus worker thread pool - never starved under load. | OS-scheduled daemon thread |
| Property | Default | Description |
|---|---|---|
app.filter.enabled | false | Enable/disable the filter globally |
app.filter.uris[0] | /api/rest | URI prefix to trace |
app.filter.dispatcher.interval.ms | 20 | Idle sleep (ms) when both queues are empty |
app.filter.dispatcher.queue.capacity | 5000 | Maximum capacity of each queue (request + response). Drop-on-full. |
@ServerRequestFilter and @ServerResponseFilter (from RESTEasy Reactive) participate in the
standard JAX-RS priority chain alongside any @Provider-based filters:
| Direction | Priority order | Position of TraceJaxRsRequestResponseFilter |
|---|---|---|
| Request | ascending (low → high) - AUTHENTICATION(1000) → USER(5000) | Last (default USER = 5000) |
| Response | descending (high → low) - USER(5000) → AUTHENTICATION(1000) | First among user filters |
Thread model - blocking vs reactive endpoints:
- Blocking endpoints (classic JAX-RS,
Responsereturn type): the filter runs on a worker thread (executor-thread-*). Body reading is performed directly in blocking mode.- Reactive endpoints (
Uni<Response>,Multi<T>): the filter runs on the I/O event loop thread (vert.x-eventloop-thread-*). Body reading is automatically delegated to a Vert.x worker thread viaVertx#executeBlocking()to avoid blocking the event loop.Note:
@NonBlockingmust not be placed on@ServerRequestFilter/@ServerResponseFiltermethods. Quarkus rejects it at build time (ExecutionModelAnnotationsProcessorthrowsIllegalStateException). TheUni<Void>return type is the only correct non-blocking signal.
The filter handles both blocking and reactive JAX-RS endpoints transparently via the
readBodyAsync() method, which applies a two-level adaptive strategy:
| Level | Trigger | Mechanism | Notes |
|---|---|---|---|
| 1 – Fast-path | Body already buffered by Vert.x (RoutingContext#body() != null && buf.length() > 0) | buf.toString(UTF-8) - O(1), zero I/O | Applies to all endpoint types when the framework pre-buffers the body |
| 2a – Blocking read on worker thread | Current thread name starts with executor-thread- | EntityStream.read() directly on the current thread | Safe: worker threads may always block |
| 2b – Blocking read on event loop | Current thread name starts with vert.x-eventloop | Vertx#executeBlocking() delegates to a Vert.x worker thread; body is restored via ByteArrayInputStream | Event loop is never blocked; VertxInputStream.readBlocking() coordinates correctly on the worker thread |
Why not
Vertx.currentContext().isEventLoopContext()? In Vert.x 4.x the Vert.x context is propagated to worker threads (executor-thread-*) keeping theEventLoopContexttype - soisEventLoopContext()returnstrueeven on physical blocking threads, making it an unreliable discriminator. The physical thread name (Thread.currentThread().getName()) is the only reliable check.
POST /api/rest/echo/reactive)The project exposes a dedicated reactive endpoint that returns Uni<Response> and runs on the
I/O event loop thread. It can be used to verify filter behavior with non-blocking endpoints:
# Call the reactive echo endpoint (runs on vert.x-eventloop-thread-*)
curl -v --http2 \
-H "Content-Type: application/json" \
-d '{"message": "Test di tracking richiesta JAX