\Swift_Plugins_ThrottlerPlugin
Throttles the rate at which emails are sent.
- Author: Chris Corbyn
Synopsis
class Swift_Plugins_ThrottlerPlugin
extends Swift_Plugins_BandwidthMonitorPlugin
implements
Swift_Plugins_Sleeper,Swift_Plugins_Timer
{
- // constants
- const BYTES_PER_MINUTE = 0x01;
- const MESSAGES_PER_SECOND = 0x11;
- const MESSAGES_PER_MINUTE = 0x10;
- // members
- private Swift_Plugins_Sleeper $_sleeper;
- private Swift_Plugins_Timer $_timer;
- private int $_start;
- private int $_rate;
- private int $_mode;
- private integer $_messages;
- // methods
- public void __construct()
- public void beforeSendPerformed()
- public void sendPerformed()
- public void sleep()
- public int getTimestamp()
- private int _throttleBytesPerMinute()
- private int _throttleMessagesPerSecond()
- private int _throttleMessagesPerMinute()
- // Inherited methods from Swift_Plugins_BandwidthMonitorPlugin
- public void beforeSendPerformed()
- public void sendPerformed()
- public void commandSent()
- public void responseReceived()
- public void write()
- public void commit()
- public void bind()
- public void unbind()
- public void flushBuffers()
- public int getBytesOut()
- public int getBytesIn()
- public void reset()
Hierarchy
Constants
Name | Value |
---|---|
BYTES_PER_MINUTE | 0x01 |
MESSAGES_PER_SECOND | 0x11 |
MESSAGES_PER_MINUTE | 0x10 |
Members
private
- $_messages
—
int
An internal counter of the number of messages sent. - $_mode
—
int
The mode for throttling. - $_rate
—
int
The rate at which messages should be sent. - $_sleeper
—
Swift_Plugins_Sleeper
The Sleeper instance for sleeping. - $_start
—
int
The time at which the first email was sent. - $_timer
—
Swift_Plugins_Timer
The Timer instance which provides the timestamp.
Methods
private
- _throttleBytesPerMinute() — Get a number of seconds to sleep for.
- _throttleMessagesPerMinute() — Get a number of seconds to sleep for.
- _throttleMessagesPerSecond() — Get a number of seconds to sleep for.
public
- __construct() — Create a new ThrottlerPlugin.
- beforeSendPerformed() — Invoked immediately before the Message is sent.
- getTimestamp() — Get the current UNIX timestamp.
- sendPerformed() — Invoked when a Message is sent.
- sleep() — Sleep for $seconds.
Inherited from Swift_Plugins_BandwidthMonitorPlugin
public
- beforeSendPerformed() — Not used.
- bind() — Attach $is to this stream.
- commandSent() — Invoked immediately following a command being sent.
- commit() — Not used.
- flushBuffers() — Not used.
- getBytesIn() — Get the total number of bytes received from the server.
- getBytesOut() — Get the total number of bytes sent to the server.
- reset() — Reset the internal counters to zero.
- responseReceived() — Invoked immediately following a response coming back.
- sendPerformed() — Invoked immediately after the Message is sent.
- unbind() — Remove an already bound stream.
- write() — Called when a message is sent so that the outgoing counter can be increased.