Interaction Cycles
Interactions between a server and a component are handled through transactions from both sides. The Server API defines a set of functions to control how these transactions are executed. By default, a complete interaction cycle starts from a component and includes the following steps, which are illustrated in Dynamic View Server: Interaction Cycle.
-
The server is notified by means of component-to-server transactions about editing operations initiated by a component on its representations.
-
When the server executes a component-to-server transaction, it creates a local server object transaction.
-
If all the editing operations involved are successful, the server object transaction is committed and a notification phase is performed by the server. Each component for which a view is opened on the modified server objects is notified about the resulting representation updates.
These updates are executed by each component within a server-to-component transaction called a notification transaction.
-
The server sends an acknowledgement to the component that initiated the interaction cycle. This acknowledgement is executed in the component within a server-to-component transaction called an acknowledgement transaction.
If the component-to-server transaction fails within the server, it is rolled back so that each modified server object is restored to its previous state. No notification cycle is performed by the server. The server only sends a set of updates to the original component to restore the consistency of the edited representation(s).
These updates are executed by the component within a server-to-component transaction called a rollback transaction.
The following diagram illustrates this mechanism:
Dynamic View Server: Interaction Cycle
Note
The execution of such an interaction cycle in a distributed application is completely asynchronous. This means that neither components nor server are blocked during the execution of a step on the other side. |
You can control the way each step of this interaction cycle is executed. In other words, you can decide on the component side:
-
how the updates performed by the component on its representations are buffered and when a component-to-server transaction is sent to the server;
-
how the server must execute the transaction, that is:
-
whether a notification cycle is required or not;
-
whether an acknowledgement transaction will be sent;
-
if the editing operations fail, how the representations updates will be rolled back.
-
On the server side, Server also allows you to control the execution of the component transaction by calling virtual functions at the beginning and the end of each execution.