Package org.atmosphere.interceptor
Class MDCInterceptor
java.lang.Object
org.atmosphere.cpr.AtmosphereInterceptorAdapter
org.atmosphere.interceptor.MDCInterceptor
- All Implemented Interfaces:
AtmosphereInterceptor,AtmosphereConfigAware,InvokationOrder
Interceptor that populates the SLF4J
MDC with Atmosphere-specific
context for structured logging. Values are set on request entry and cleared
after processing to avoid leaking into unrelated threads.
MDC keys
atmosphere.uuid— the unique resource identifieratmosphere.transport— the transport type (websocket, long-polling, sse, etc.)atmosphere.broadcaster— the broadcaster ID this resource is attached to
Logback pattern example
%d{HH:mm:ss.SSS} [%thread] %-5level [uuid=%X{atmosphere.uuid} transport=%X{atmosphere.transport}] %logger{36} - %msg%n
JSON layout (logback-contrib or logstash-logback-encoder)
MDC keys are automatically included as top-level fields in JSON output.- Since:
- 4.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.atmosphere.interceptor.InvokationOrder
InvokationOrder.PRIORITY -
Field Summary
FieldsFields inherited from interface org.atmosphere.interceptor.InvokationOrder
AFTER_DEFAULT, BEFORE_DEFAULT, FIRST_BEFORE_DEFAULT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionInvoked before anAtmosphereResourcegets dispatched toAtmosphereHandler.voidInvoked after anAtmosphereResourcegets dispatched toAtmosphereHandler.toString()Methods inherited from class org.atmosphere.cpr.AtmosphereInterceptorAdapter
configure, destroy, priority
-
Field Details
-
MDC_UUID
- See Also:
-
MDC_TRANSPORT
- See Also:
-
MDC_BROADCASTER
- See Also:
-
-
Constructor Details
-
MDCInterceptor
public MDCInterceptor()
-
-
Method Details
-
inspect
Description copied from interface:AtmosphereInterceptorInvoked before anAtmosphereResourcegets dispatched toAtmosphereHandler.- Specified by:
inspectin interfaceAtmosphereInterceptor- Overrides:
inspectin classAtmosphereInterceptorAdapter- Parameters:
r- aAtmosphereResource- Returns:
Action.CONTINUEorAction.SUSPENDto dispatch theAtmosphereResourceto otherAtmosphereInterceptororAtmosphereHandler. ReturnAction.TYPE.CANCELLEDto stop the processing.
-
postInspect
Description copied from interface:AtmosphereInterceptorInvoked after anAtmosphereResourcegets dispatched toAtmosphereHandler.- Specified by:
postInspectin interfaceAtmosphereInterceptor- Overrides:
postInspectin classAtmosphereInterceptorAdapter- Parameters:
r- aAtmosphereResource
-
toString
- Overrides:
toStringin classAtmosphereInterceptorAdapter
-