Package org.atmosphere.interceptor
Class MessageAckInterceptor
java.lang.Object
org.atmosphere.cpr.AtmosphereInterceptorAdapter
org.atmosphere.interceptor.MessageAckInterceptor
- All Implemented Interfaces:
AtmosphereInterceptor,AtmosphereConfigAware,InvokationOrder
Interceptor that implements message acknowledgment for reliable delivery.
When a client sends a message with an X-Atmosphere-Message-Id header
or query parameter, the server echoes back an X-Atmosphere-Ack header
with the same ID to confirm receipt. If no ID is provided, the server generates
one and attaches it as a request attribute for downstream handlers.
This interceptor works together with the client-side offline queue and optimistic update system to provide reliable, at-least-once delivery.
- Since:
- 4.0.8
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.atmosphere.interceptor.InvokationOrder
InvokationOrder.PRIORITY -
Field Summary
Fields inherited from interface org.atmosphere.interceptor.InvokationOrder
AFTER_DEFAULT, BEFORE_DEFAULT, FIRST_BEFORE_DEFAULT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(AtmosphereConfig config) Configure an AtmosphereFramework object.Invoked before anAtmosphereResourcegets dispatched toAtmosphereHandler.priority()Return the priority an AtmosphereInterceptor must be executed.toString()longReturns the total number of acknowledged messages.Methods inherited from class org.atmosphere.cpr.AtmosphereInterceptorAdapter
destroy, postInspect
-
Constructor Details
-
MessageAckInterceptor
public MessageAckInterceptor()
-
-
Method Details
-
configure
Description copied from interface:AtmosphereConfigAwareConfigure an AtmosphereFramework object.- Specified by:
configurein interfaceAtmosphereConfigAware- Overrides:
configurein classAtmosphereInterceptorAdapter- Parameters:
config-AtmosphereConfig
-
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.
-
totalAcks
public long totalAcks()Returns the total number of acknowledged messages. -
priority
Description copied from interface:InvokationOrderReturn the priority an AtmosphereInterceptor must be executed.- Specified by:
priorityin interfaceInvokationOrder- Overrides:
priorityin classAtmosphereInterceptorAdapter- Returns:
- PRIORITY
-
toString
- Overrides:
toStringin classAtmosphereInterceptorAdapter
-