Class AcknowledgedMessagesSessionExtension
- java.lang.Object
-
- org.cometd.server.ext.AcknowledgedMessagesSessionExtension
-
- All Implemented Interfaces:
java.util.EventListener,Bayeux.BayeuxListener,ServerSession.DeQueueListener,ServerSession.Extension,ServerSession.QueueListener,ServerSession.ServerSessionListener
public class AcknowledgedMessagesSessionExtension extends java.lang.Object implements ServerSession.Extension, ServerSession.DeQueueListener, ServerSession.QueueListener
Tracks the batch id of messages sent to a client.
-
-
Constructor Summary
Constructors Constructor Description AcknowledgedMessagesSessionExtension(ServerSession session)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(AcknowledgedMessagesExtension.Listener listener)voiddeQueue(ServerSession session, java.util.Queue<ServerMessage> queue)Callback invoked to notify that the queue of messages is about to be sent to the remote client.voiddeQueue(ServerSession session, java.util.Queue<ServerMessage> queue, java.util.List<ServerMessage.Mutable> replies)Callback invoked to notify that the queue of messages and the message replies are about to be sent to the remote client.intgetMaxQueueSize()protected voidimportMessages(ServerSessionImpl session)protected voidprocessBatch(long batch)voidqueued(ServerSession sender, ServerMessage message)Callback invoked when a message is queued in the session queue.booleanrcv(ServerSession from, ServerMessage.Mutable message)Blocking version ofServerSession.Extension.incoming(ServerSession, ServerMessage.Mutable, Promise)for non-meta messages.booleanrcvMeta(ServerSession session, ServerMessage.Mutable message)Blocking version ofServerSession.Extension.incoming(ServerSession, ServerMessage.Mutable, Promise)for meta messages.voidremoveListener(AcknowledgedMessagesExtension.Listener listener)ServerMessagesend(ServerSession sender, ServerSession session, ServerMessage message)Blocking version ofServerSession.Extension.outgoing(ServerSession, ServerSession, ServerMessage.Mutable, Promise)for non-meta messages.booleansendMeta(ServerSession sender, ServerSession to, ServerMessage.Mutable message)Blocking version ofServerSession.Extension.outgoing(ServerSession, ServerSession, ServerMessage.Mutable, Promise)for meta messages.voidsetMaxQueueSize(int maxQueueSize)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.cometd.bayeux.server.ServerSession.Extension
incoming, outgoing
-
-
-
-
Constructor Detail
-
AcknowledgedMessagesSessionExtension
public AcknowledgedMessagesSessionExtension(ServerSession session)
-
-
Method Detail
-
addListener
public void addListener(AcknowledgedMessagesExtension.Listener listener)
-
removeListener
public void removeListener(AcknowledgedMessagesExtension.Listener listener)
-
getMaxQueueSize
public int getMaxQueueSize()
-
setMaxQueueSize
public void setMaxQueueSize(int maxQueueSize)
-
rcv
public boolean rcv(ServerSession from, ServerMessage.Mutable message)
Description copied from interface:ServerSession.ExtensionBlocking version of
ServerSession.Extension.incoming(ServerSession, ServerMessage.Mutable, Promise)for non-meta messages.- Specified by:
rcvin interfaceServerSession.Extension- Parameters:
from- the session that sent the messagemessage- the incoming message- Returns:
- whether message processing should continue
-
rcvMeta
public boolean rcvMeta(ServerSession session, ServerMessage.Mutable message)
Description copied from interface:ServerSession.ExtensionBlocking version of
ServerSession.Extension.incoming(ServerSession, ServerMessage.Mutable, Promise)for meta messages.- Specified by:
rcvMetain interfaceServerSession.Extension- Parameters:
session- the session that sent the messagemessage- the incoming message- Returns:
- whether message processing should continue
-
processBatch
protected void processBatch(long batch)
-
send
public ServerMessage send(ServerSession sender, ServerSession session, ServerMessage message)
Description copied from interface:ServerSession.ExtensionBlocking version of
ServerSession.Extension.outgoing(ServerSession, ServerSession, ServerMessage.Mutable, Promise)for non-meta messages.- Specified by:
sendin interfaceServerSession.Extension- Parameters:
sender- the session that sent the message or nullsession- the session receiving the messagemessage- the outgoing message- Returns:
- the message to send or null to not send the message
-
queued
public void queued(ServerSession sender, ServerMessage message)
Description copied from interface:ServerSession.QueueListenerCallback invoked when a message is queued in the session queue.
- Specified by:
queuedin interfaceServerSession.QueueListener- Parameters:
sender- the ServerSession that sends the message, may be null.message- the message being queued
-
sendMeta
public boolean sendMeta(ServerSession sender, ServerSession to, ServerMessage.Mutable message)
Description copied from interface:ServerSession.ExtensionBlocking version of
ServerSession.Extension.outgoing(ServerSession, ServerSession, ServerMessage.Mutable, Promise)for meta messages.- Specified by:
sendMetain interfaceServerSession.Extension- Parameters:
sender- the session that sent the message or nullto- the session receiving the messagemessage- the outgoing message- Returns:
- whether message processing should continue
-
deQueue
public void deQueue(ServerSession session, java.util.Queue<ServerMessage> queue, java.util.List<ServerMessage.Mutable> replies)
Description copied from interface:ServerSession.DeQueueListenerCallback invoked to notify that the queue of messages and the message replies are about to be sent to the remote client.
This is the last chance to process the queue, to remove duplicates or merge messages, and to process the replies.
- Specified by:
deQueuein interfaceServerSession.DeQueueListener- Parameters:
session- the session whose messages are being sentqueue- the queue of messages to sendreplies- the message replies to send
-
deQueue
public void deQueue(ServerSession session, java.util.Queue<ServerMessage> queue)
Description copied from interface:ServerSession.DeQueueListenerCallback 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:
deQueuein interfaceServerSession.DeQueueListener- Parameters:
session- the session whose messages are being sentqueue- the queue of messages to send
-
importMessages
protected void importMessages(ServerSessionImpl session)
-
-