Definition as Synchronous or Asynchronous Method? 

When deciding whether you want to define a method as synchronous or asynchronous, consider the environment of subsequent use of a method in a single-step task:

Definition as

 

asynchronous method

A single-step task that refers to an asynchronous object method must be defined with at least one terminating event. When you define an asynchronous method, relevant events from the environment of the processed object must be also available, which can report a processing result for the method.

At runtime, the relevant work item is only terminated if one of the defined terminating events occurs.

synchronous method

A single-step task that refers to a synchronous object method can be defined with terminating events.

At runtime, the relevant work item is generally terminated when the synchronous method is successfully executed. But the work item is also terminated if one of the defined terminating events occurs.

When do you define asynchronous methods?

You define a method as an asynchronous method if you want a single-step task that uses this method to be terminated only via events.

The following are possible reasons for defining a method as asynchronous:

The method is then terminated by an event generated when the update is successful.

If you nevertheless define the method as a synchronous method under these circumstances, inconsistencies between the workflow and the current status in the database can arise because of update terminations or delays.

If it is possible that a user may call the transaction encapsulated in the method outside the workflow (through ignorance, by force of habit or for convenience), although the object is also being processed under the control of a workflow at the same time, you should implement the method as an asynchronous method.

The reporting back to the workflow system then takes place via an event. It is therefore irrelevant whether the call took place inside or outside the workflow system. This event must be defined for the object type and its generation must be guaranteed.

In a single-step task, a specific order is to be released for billing. In the single-step task, call the (general) method Process order and enter the (specific) event Billing block deleted as terminating event.

The single-step task in which the method Process sales order is executed is also terminated by the event Customer unable to pay.

When do you define synchronous methods?

You define a method as a synchronous method in particular if you want to use the processing results as method parameters or results.

The following are also possible reasons for defining a method as synchronous:

The method Display for displaying an object

The method Write letter