Package com.yahoo.messagebus
Interface ThrottlePolicy
-
- All Known Implementing Classes:
AllPassThrottlePolicy
,DynamicThrottlePolicy
,RateThrottlingPolicy
,StaticThrottlePolicy
public interface ThrottlePolicy
An implementation of this interface is used bySourceSession
to throttle output. Every message enteringSourceSession.send(Message)
needs to be accepted by this interface'scanSend(Message, int)
method. All messages accepted are passed through theprocessMessage(Message)
method, and the corresponding replies are passed through theprocessReply(Reply)
method.- Author:
- Simon Thoresen Hult
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canSend(Message message, int pendingCount)
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 Detail
-
canSend
boolean canSend(Message message, int pendingCount)
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
void processMessage(Message message)
This method is called once for every message that was accepted bycanSend(Message, int)
and sent.- Parameters:
message
- the message being sent
-
processReply
void processReply(Reply reply)
This method is called once for every reply that is received.- Parameters:
reply
- the reply received
-
-