Package org.cometd.client.transport
Interface TransportListener
-
- All Superinterfaces:
java.util.EventListener
public interface TransportListener extends java.util.EventListener
Abstracts the communication between
BayeuxClient
andClientTransport
.A
TransportListener
is associated to every batch of messages being sent, and notified when responses for those messages come back, or a failure occurs.- See Also:
MessageClientTransport
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default void
onFailure(java.lang.Throwable failure, java.util.List<? extends Message> messages)
Callback method invoked when a failure to send or receive messages occurs.default void
onMessages(java.util.List<Message.Mutable> messages)
Callback method invoked when a batch of message is received.default void
onSending(java.util.List<? extends Message> messages)
Callback method invoked when the batch of messages is being sent.default void
onTimeout(java.util.List<? extends Message> messages, Promise<java.lang.Long> promise)
Callback method invoked when the send of a batch of messages expires before receiving a response from the server, controlled by themaxNetworkDelay
option.
-
-
-
Method Detail
-
onSending
default void onSending(java.util.List<? extends Message> messages)
Callback method invoked when the batch of messages is being sent.- Parameters:
messages
- the batch of messages being sent
-
onMessages
default void onMessages(java.util.List<Message.Mutable> messages)
Callback method invoked when a batch of message is received.- Parameters:
messages
- the batch of messages received
-
onFailure
default void onFailure(java.lang.Throwable failure, java.util.List<? extends Message> messages)
Callback method invoked when a failure to send or receive messages occurs.- Parameters:
failure
- the failure occurredmessages
- the batch of messages being sent
-
onTimeout
default void onTimeout(java.util.List<? extends Message> messages, Promise<java.lang.Long> promise)
Callback method invoked when the send of a batch of messages expires before receiving a response from the server, controlled by the
maxNetworkDelay
option.Implementations may extend the wait by succeeding the promise with the number of milliseconds of the extended wait.
Succeeding the callback with
0
or a negative value confirms the expiration, which will eventually callonFailure(Throwable, List)
with aTimeoutException
.- Parameters:
messages
- the batch of messages sentpromise
- the promise to complete
-
-