TAsyncClientPool

A TAsyncClientPoolBase implementation which queries multiple servers in a row until a request succeeds, the result of which is then returned.

The definition of »success« can be customized using the rpcFaultFilter() delegate property. If it is non-null and calling it for an exception set by a failed method invocation returns true, the error is considered to be caused by the RPC layer rather than the application layer, and the next server in the pool is tried. If there are no more clients to try, the operation is marked as failed with a TCompoundOperationException.

If a TAsyncClient in the pool fails with an RPC exception for a number of consecutive tries, it is temporarily disabled (not tried any longer) for a certain duration. Both the limit and the timeout can be configured. If all clients fail (and keepTrying is false), the operation fails with a TCompoundOperationException which contains the collected RPC exceptions.

Constructors

this
this(Client[] clients)

Members

Functions

addClient
void addClient(Client client)
Undocumented in source. Be warned that the author may not have intended to support it.
executeOnPool
auto executeOnPool(Args args, TCancellation cancellation)
Undocumented in source. Be warned that the author may not have intended to support it.
faultDisableCount
ushort faultDisableCount()
void faultDisableCount(ushort value)

The number of consecutive faults after which a client is disabled until faultDisableDuration has passed. 0 to never disable clients.

faultDisableDuration
Duration faultDisableDuration()
void faultDisableDuration(Duration value)

The duration for which a client is no longer considered after it has failed too often.

keepTrying
bool keepTrying()
void keepTrying(bool value)

Whether to keep trying to find a working client if all have failed in a row.

permuteClients
bool permuteClients()
void permuteClients(bool value)

Whether to use a random permutation of the client pool on every call to execute(). This can be used e.g. as a simple form of load balancing.

removeClient
bool removeClient(Client client)
Undocumented in source. Be warned that the author may not have intended to support it.
reopenTransports
bool reopenTransports()
Undocumented in source. Be warned that the author may not have intended to support it.
reopenTransports
void reopenTransports(bool value)
Undocumented in source. Be warned that the author may not have intended to support it.
rpcFaultFilter
bool delegate(Exception) rpcFaultFilter()
Undocumented in source. Be warned that the author may not have intended to support it.
rpcFaultFilter
void rpcFaultFilter(bool delegate(Exception) value)
Undocumented in source. Be warned that the author may not have intended to support it.

Meta