Previous Topic: Scenario C: Asynchronous processingNext Topic: Scenario C: ImportObjectAsync() Parameters


Scenario C: Processing steps

  1. CoCreate the COM object: CoCreate WgnActiveImportConnector and then obtain the IWgnImportConnectorConfig interface. As with scenario A, in this scenario there is no need to use the IWgnImportConnectorConfig interface.
  2. IWgnActiveImportConnector interface: The calling application calls the ImportObjectAsync() method to asynchronously pass an e-mail to the External Agent. This method also takes an IWgnImportConnectorCallback interface pointer to an object hosted by the caller so the External Agent can return the results of processing (that is, any applicable smart tags) to the caller when processing is complete.

    As with scenario A, this scenario assumes that the caller does not intend to send the e‑mail to an archive and that deferred completion is not enabled.

    The parameters values needed to implement this scenario are:

Parameters

Value

Notes

messageId

NULL

The caller does not archive e-mails after policy processing.

importSource

WGN_ACTIVEIMPORTSOURCE_NONE

 

 

The caller does not archive e-mails after policy processing.

xmlMessageAttributes

NULL

The caller does not pass additional event attribute data to the External Agent.

allowDeferredCompletion

FALSE

In scenario C, events processed by the policy engine can be committed to the CMS database without waiting for the client to process the results of policy analysis.

contextTag

Any value

An e-mail identifier. The External Agent returns the same value to the caller in the subsequent callback (see step 3), enabling the caller to match the callback to the original e‑mail.

asyncCallback

Interface pointer

A pointer to an interface implemented by a caller-defined class, through which WgnActiveImportConnector will inform the caller of the results from processing the message.

Note: For the full set of parameter values that must be passed to ImportObjectAsync() when processing a MAPI message, see Input Combinations for ImportObject() Method.

  1. IWgnImportConnectorCallback interface: When the External Agent has finished processing each e-mail, it notifies the caller and returns the results of any policy processing.
  2. To do this, the External Agent calls the onUpdate() method on the IWgnImportConnectorCallback interface to the COM object created by the caller. This call includes the contextTag identifier passed in step 2, enabling the caller to match the callback to an e-mail, plus the IWgnImportConnectorResult interface.
  3. IWgnSmartTag interface: If the call to ImportObjectAsync() is successful, the caller can call GetInterface() on the IWgnImportConnectorResult interface returned in step 3 to obtain the IWgnSmartTag interface. This enables the caller to retrieve the results of analyzing the e-mail plus any smart tags.
  4. Process the smart tags: The caller can process any smart tags assigned to the e-mail by calling methods in the IWgnSmartTag interface. The GetSmartTagXML() method retrieves the message smart tags encoded in XML. Or the caller can enumerate the smart tags by calling methods such as GetCount() and GetSmartTag().

    Note: Steps 3-4-5 are performed once for each e-mail. That is, this sequence (3-4-5) is repeated for each e-mail passed to the External Agent. At any time, there may be multiple threads each performing steps 3-4-5.

  5. Release the interfaces: After each message has been processed, the caller must release the 'message processing' interfaces. In this scenario, these are the IWgnImportConnectorResult and IWgnSmartTag interfaces.

    The WgnActiveImportConnector boundary interfaces must be released at the end of the session. These are the IWgnImportConectorConfig (if queried) and IWgnActiveImportConnector interfaces.