Agent.GetAgentAsyncContext method

When overridden in a derived class, gets a AgentAsyncContext object to mark the executing event handler to execute asynchronously.

Namespace:  Microsoft.Exchange.Data.Transport
Assembly:  Microsoft.Exchange.Data.Transport (in Microsoft.Exchange.Data.Transport.dll)

Syntax

'Declaration
Protected Function GetAgentAsyncContext As AgentAsyncContext
'Usage
Dim returnValue As AgentAsyncContext

returnValue = Me.GetAgentAsyncContext()
protected AgentAsyncContext GetAgentAsyncContext()

Return value

Type: Microsoft.Exchange.Data.Transport.AgentAsyncContext
An AgentAsyncContext object that is used by an asynchronous event handler.

Remarks

Thread starvation can occur if the code that is executing asynchronously takes a long time to finish. Therefore, it is important to monitor the thread pool and reuse threads that are allocated to instances of your agent.

Warning

If thread starvation occurs because of an asynchronous agent, the SMTP service might stop responding to incoming connection attempts.

You should log an error to the event log if thread starvation occurs. Logging the error to the event log enables administrators and applications that monitor the event log to find and take action on the thread starvation.

See also

Reference

Agent class

Agent members

Microsoft.Exchange.Data.Transport namespace