Using Synchronous and Asynchronous Modes

You can specify whether you want operations in a given module to function synchronously or asynchronously.

Naming Conventions for Operations to be Used in Asynchronous Mode

The naming conventions you use for operations (also known as services) can affect asynchronous mode. To ensure that your operation names map properly for async mode, do not use two operations in the same project whose names are distinguishable only because one has an underscore and one does not.

For example, you cannot have the following two operations in the same interface:

The reason for this is that having these two similarly named operations in async mode will result in having two different event methods with the same name.

When the Active Expert creates an ActiveX control, it creates events and corresponding methods. The Active Expert uses operation names as a basis for naming associated event methods, but ignores the underscores as a part of this process.

For a given interface with an operation called myservice, the Active Expert creates an event method called myserviceasyncdone. Similarly, for an operation called my_service, the Active Expert creates an event method with the exact same name (myserviceasyncdone).

Viewing Objects in Asynchronous Mode

To view objects in asynchronous mode:

  1. Make sure the Workstation Objects window has the focus.

  2. Choose View->Async from the menu bar

    Or

    Click on the async toolbar button.

    (The keyboard shortcut to show asynchronous mode is Alt V A.)

    This shows the workstation objects in asynchronous mode as shown in Figure 3-5.

    Figure 3-5 Workstation Objects in Asynchronous Mode

In the figure, the module BANKAPP is expanded to show the asynchronous operations contained in the TELLER interface. Note that the asynchronous operations are named in the form OperationNameAsync. The sample code shown returns the requested values as output parameters of the selected reply object operation.

Switching Back to Synchronous Mode

To view objects in synchronous mode:

  1. Make sure the Workstation Objects window has the focus.

  2. Choose View->Sync from the menu bar

    Or

    Click on the sync toolbar button.

    (The keyboard shortcut to show synchronous mode is Alt V Y.)

    This shows the workstation objects in synchronous mode.