- class slimta.relay.pool.RelayPool([pool_size=None])¶
Base class that inherits
Relayto add the ability to create bounded, cached pools of outbound clients. It maintains a queue of messages to be delivered such that idle clients in the pool pick them up.
pool_size – At most this many simultaneous connections will be open to a destination. If this limit is reached and no connections are idle, new attempts will block.
This attribute holds the queue object for providing delivery requests to idle clients in the pool.
Sub-classes must override this method to create and return a new
RelayPoolClientobject that will poll for delivery requests.
- Return type
- attempt(envelope, attempts)¶
This method must be overridden by sub-classes in order to be passed in to the
The result of a successful relay attempt is either
Replyobject. The result of a failing relay attempt is either a
If the result applies to the entire
envelopeand all its recipients, implementations may return the successful result or raise the failure. If the result is different per-recipient, then implementations may return a dictionary where the key is a recipient from
recipientsand the value is the relay result (successful or failing).
Envelopeto attempt delivery for.
attempts – Number of times the envelope has attempted delivery.
The relay result, as described above.
- class slimta.relay.pool.RelayPoolClient(queue[, idle_timeout=None])¶
Base class for implementing clients for handling delivery requests in a
queue – The queue on which delivery requests will be received.
idle_timeout – If the client can handle multiple, pipelined delivery requests, this is the timeout in seconds that a client will wait for subsequent requests.
This attribute holds the idle timeout for handling multiple delivery requests on the client.
This method can be used by clients to receive new delivery requests from the client pool. This method will block until a delivery request is received.