다음을 통해 공유


IAsyncNotify Interface

Topic Last Modified: 2006-06-13

This interface enables an asynchronous event handler to notify Microsoft® Exchange Server 2007 that it has finished processing an event.

Type Library

EXOLEDB Type Library

EXOLEDB Event Sink Type Library

DLL Implemented In

EXOLEDB.DLL, EXEVTSNK.TLB

Member Summary

The following table lists the methods of the IAsyncNotify interface.

Name Description

Completed

This method allows an asynchronous event handler to notify Exchange that it has finished processing an event.

Remarks

When handling an asynchronous event using a Component Object Model (COM) handler, it is best for the handler to create a new thread to process the event and immediately return S_PENDING. After the handler has finished processing, it then calls back to the store with IAsyncNotify::Completed.

This is because COM calls are synchronous, therefore the thread the store uses to call the handler is blocked while it waits for the method call to return. Thus best practice for scalability is for the handler to return as soon as possible and process the event asynchronously. When a handler returns S_PENDING, the store does not remove the event from its events queue. When the handler calls back with IAsyncNotify::Completed, only then does the store remove the event from its events queue. This allows the store to guarantee events are processed, without blocking its own threads to wait for the processing to complete.

You can get the IAsyncNotify interface from the IExStoreEventInfo Interface that is passed to your Asynchronous sink.

IAsyncNotify is not a dual interface. Microsoft Visual Basic® and Visual Basic Scripting Edition (VBScript) programmers who want to use this interface should add a reference to the EXOLEDB Event Sink Type Library (EXEVTSNK.TLB). EXEVTSNK.TLB is downloaded with the Exchange Server 2003 Software Development Kit (SDK) to the \Program Files\Exchange SDK\SDK\Support\OLEDB\ directory.