Class Swift_Plugins_ThrottlerPlugin

InheritanceSwift_Plugins_ThrottlerPlugin » Swift_Plugins_BandwidthMonitorPlugin
ImplementsSwift_Events_CommandListener, Swift_Events_ResponseListener, Swift_Events_SendListener, Swift_InputByteStream, Swift_Plugins_Sleeper, Swift_Plugins_Timer

Throttles the rate at which emails are sent.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Create a new ThrottlerPlugin. Swift_Plugins_ThrottlerPlugin
beforeSendPerformed() Invoked immediately before the Message is sent. Swift_Plugins_ThrottlerPlugin
bind() Attach $is to this stream. Swift_Plugins_BandwidthMonitorPlugin
commandSent() Invoked immediately following a command being sent. Swift_Plugins_BandwidthMonitorPlugin
commit() Not used. Swift_Plugins_BandwidthMonitorPlugin
flushBuffers() Not used. Swift_Plugins_BandwidthMonitorPlugin
getBytesIn() Get the total number of bytes received from the server. Swift_Plugins_BandwidthMonitorPlugin
getBytesOut() Get the total number of bytes sent to the server. Swift_Plugins_BandwidthMonitorPlugin
getTimestamp() Get the current UNIX timestamp. Swift_Plugins_ThrottlerPlugin
reset() Reset the internal counters to zero. Swift_Plugins_BandwidthMonitorPlugin
responseReceived() Invoked immediately following a response coming back. Swift_Plugins_BandwidthMonitorPlugin
sendPerformed() Invoked when a Message is sent. Swift_Plugins_ThrottlerPlugin
sleep() Sleep for $seconds. Swift_Plugins_ThrottlerPlugin
unbind() Remove an already bound stream. Swift_Plugins_BandwidthMonitorPlugin
write() Called when a message is sent so that the outgoing counter can be increased. Swift_Plugins_BandwidthMonitorPlugin


Hide inherited constants

ConstantValueDescriptionDefined By
BYTES_PER_MINUTE 1 Flag for throttling in bytes per minute Swift_Plugins_ThrottlerPlugin
MESSAGES_PER_MINUTE 16 Flag for throttling in emails per minute Swift_Plugins_ThrottlerPlugin
MESSAGES_PER_SECOND 17 Flag for throttling in emails per second (Amazon SES) Swift_Plugins_ThrottlerPlugin

Method Details

__construct() public method

Create a new ThrottlerPlugin.

public void __construct ( $rate, $mode self::BYTES_PER_MINUTE, Swift_Plugins_Sleeper $sleeper null, Swift_Plugins_Timer $timer null )
$rate int
$sleeper Swift_Plugins_Sleeper

(only needed in testing)

$timer Swift_Plugins_Timer

(only needed in testing)

beforeSendPerformed() public method

Invoked immediately before the Message is sent.

public void beforeSendPerformed ( Swift_Events_SendEvent $evt )
$evt Swift_Events_SendEvent
getTimestamp() public method

Get the current UNIX timestamp.

public int getTimestamp ( )
sendPerformed() public method

Invoked when a Message is sent.

public void sendPerformed ( Swift_Events_SendEvent $evt )
$evt Swift_Events_SendEvent
sleep() public method

Sleep for $seconds.

public void sleep ( $seconds )
$seconds int