Platform SDK: Exchange 2000 Server

Synchronous Event Details

[This is preliminary documentation and subject to change.]

The following information is important to know when developing the interfaces for synchronous event sinks.

The item being passed through the synchronous event transaction is not the item in the Web Store. The item being passed is the item in transition--a copy. Additionally, for the OnSyncSave event, the sink is given a URL to an original image of the item before any synchronous events were called.

The following illustration shows a Web Store item and how event sinks affect it.

  1. The event occurs in the store.
  2. An image is created of the Item.
  3. 8Synchronous interface methods in sink classes receive notification of the synchronous event and modify then image.
  4. The image is committed to the store as the item (from the OLE DB Transaction).
  5. Synchronous interface methods in sink classes receive notification of the commit phase.
  6. Asynchronous interface methods in sink classes receive notifications. The store Item is directly modified.

    Note   Asynchronous events are processed in no specified or guaranteed order. The event source does not wait for asynchronous events to finish.

As the above illustration shows, Synchronous events are always called twice, once for the transaction and once for commit or abort. It is important to add code in your methods for handling synchronous events to determine which type of call is being made. The filter in an IExStoreSyncEvents::OnSyncSave method could look like this:

[C++]
if( lFlags & EVT_SYNC_BEGIN ) {
    Log(pLog,"-----------EVT_SYNC_BEGIN-----------\r\n");
    //Handle the sink here.
}
else if( lFlags & EVT_SYNC_COMMITTED ) {
    Log(pLog,"---------EVT_SYNC_COMMITTED---------\r\n");
    //Handle the commit here.
}
else if( lFlags & EVT_SYNC_ABORTED ) {
    Log(pLog,"----------EVT_SYNC_ABORTED----------\r\n");
    //Handle the abort here.
}

An item created during the context of a transaction does not exist in the Web Store until the transaction has been committed. Actions performed within a transaction will not cause another event to occur until the transaction has been committed. This means that if an OnSyncSave sink saves some other item, the Web Store processes the new OnSave event only after the current transaction is committed. Additionally, it is not possible to create an item and then open it using IBindResource::Bind without first committing the transaction.