Package org.cometd.server.ext
Class AcknowledgedMessagesSessionExtension
java.lang.Object
org.cometd.server.ext.AcknowledgedMessagesSessionExtension
- All Implemented Interfaces:
EventListener
,Bayeux.BayeuxListener
,ServerSession.DeQueueListener
,ServerSession.Extension
,ServerSession.QueueListener
,ServerSession.ServerSessionListener
public class AcknowledgedMessagesSessionExtension extends Object implements ServerSession.Extension, ServerSession.DeQueueListener, ServerSession.QueueListener
Tracks the batch id of messages sent to a client.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.cometd.bayeux.server.ServerSession.Extension
ServerSession.Extension.Adapter
-
Constructor Summary
Constructors Constructor Description AcknowledgedMessagesSessionExtension(ServerSession session)
-
Method Summary
Modifier and Type Method Description void
deQueue(ServerSession session, Queue<ServerMessage> queue)
Callback invoked to notify that the queue of messages is about to be sent to the remote client.protected void
importMessages(ServerSessionImpl session)
protected void
processBatch(long batch)
void
queued(ServerSession sender, ServerMessage message)
Callback invoked when a message is queued in the session queue.boolean
rcv(ServerSession from, ServerMessage.Mutable message)
Callback method invoked every time a normal message is incoming.boolean
rcvMeta(ServerSession session, ServerMessage.Mutable message)
Callback method invoked every time a meta message is incoming.ServerMessage
send(ServerSession session, ServerMessage message)
Callback method invoked every time a normal message is outgoing.boolean
sendMeta(ServerSession to, ServerMessage.Mutable message)
Callback method invoked every time a meta message is outgoing.
-
Constructor Details
-
Method Details
-
rcv
Description copied from interface:ServerSession.Extension
Callback method invoked every time a normal message is incoming.
- Specified by:
rcv
in interfaceServerSession.Extension
- Parameters:
from
- the session that sent the messagemessage
- the incoming message- Returns:
- true if message processing should continue, false if it should stop
-
rcvMeta
Description copied from interface:ServerSession.Extension
Callback method invoked every time a meta message is incoming.
- Specified by:
rcvMeta
in interfaceServerSession.Extension
- Parameters:
session
- the session that is sent the messagemessage
- the incoming meta message- Returns:
- true if message processing should continue, false if it should stop
-
processBatch
protected void processBatch(long batch) -
send
Description copied from interface:ServerSession.Extension
Callback method invoked every time a normal message is outgoing.
- Specified by:
send
in interfaceServerSession.Extension
- Parameters:
session
- the session receiving the messagemessage
- the outgoing message- Returns:
- The message to send or null to not send the message
-
queued
Description copied from interface:ServerSession.QueueListener
Callback invoked when a message is queued in the session queue.
- Specified by:
queued
in interfaceServerSession.QueueListener
- Parameters:
sender
- the ServerSession that sends the message, may be null.message
- the message being queued
-
sendMeta
Description copied from interface:ServerSession.Extension
Callback method invoked every time a meta message is outgoing.
- Specified by:
sendMeta
in interfaceServerSession.Extension
- Parameters:
to
- the session receiving the messagemessage
- the outgoing meta message- Returns:
- true if message processing should continue, false if it should stop
-
deQueue
Description copied from interface:ServerSession.DeQueueListener
Callback invoked to notify that the queue of messages is about to be sent to the remote client.
This is the last chance to process the queue and remove duplicates or merge messages.
- Specified by:
deQueue
in interfaceServerSession.DeQueueListener
- Parameters:
session
- the session whose messages are being sentqueue
- the queue of messages to send
-
importMessages
-