Package com.yahoo.messagebus
Interface ThrottlePolicy
- All Known Implementing Classes:
AllPassThrottlePolicy
,DynamicThrottlePolicy
,RateThrottlingPolicy
,StaticThrottlePolicy
public interface ThrottlePolicy
An implementation of this interface is used by
SourceSession
to throttle output. Every message entering
SourceSession.send(Message)
needs to be accepted by this interface's canSend(Message, int)
method.
All messages accepted are passed through the processMessage(Message)
method, and the corresponding replies
are passed through the processReply(Reply)
method.- Author:
- Simon Thoresen Hult
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns whether or not the given message can be sent according to the current state of this policy.void
processMessage
(Message message) This method is called once for every message that was accepted bycanSend(Message, int)
and sent.void
processReply
(Reply reply) This method is called once for every reply that is received.
-
Method Details
-
canSend
Returns whether or not the given message can be sent according to the current state of this policy.- Parameters:
message
- the message to evaluatependingCount
- the current number of pending messages- Returns:
- true to send the message
-
processMessage
This method is called once for every message that was accepted bycanSend(Message, int)
and sent.- Parameters:
message
- the message being sent
-
processReply
This method is called once for every reply that is received.- Parameters:
reply
- the reply received
-