How Do I Use the Core Functions Available for a Flow?
The code generated after building a flo-lang solution provides a number of standard features that allow you to interact with the domain.
Informing the Domain That a Payment Has Timed Out
When a payment times out, it is necessary to tell the domain that this has occured. To do this, a helper class is available on the domain.
XYZDomain.timeout().execute(aggregateId, actionName);
Ad-hoc functions within the domain
The domain class also provides the ability to perform ad-hoc functions within the flow these are:
-
Aborting a payment
-
Accessing the payments status
-
Accessing the payments aggregate
These can all be done directly by calling the appropriate method on the domain class itself:
XYZDomain.abort(aggregateId, reason);
XYZDomain.getStatus(aggregateId);
XYZDomain.getAggregate(aggregateId);
Identifying the available flows and versions
We can also call a set of methods provided by the domain to query details about each of the flows that are available within it: For each flow we have a static access available as per below:
XYZDomain.Flows.AFlow.name();
XYZDomain.Flows.AFlow.getAggregate();
XYZDomain.Flows.AFlow.getLatestVersion();