New in 0.16.2

v0.16.3

Workflow

Properties

It could be useful to expose public properties of our workflow. We will illustrate this with the small example of a very simple loyalty program:

The workflow above basically increment a points counter every week for a year. Note how easy it is to code it using Infinitic!

Now, we will see:

  • how to know the current values of points
  • how to add bonus points for exceptional events

Getting workflow properties

To get the current values of points, we only need to add a getter to it in the workflow interface (in Kotlin, we only need to set points as public to create the corresponding getter/setter):

That's all we need, as a client (or another workflow) can now access the value of points by targeting the right workflow and synchrously running the getter method on it (as explained here):

Of course, if needed, we can apply a similar technique for setters!

Trigger action on a running workflow

Let's add a method adding points for exceptional events:

That's basically all we need. Now, we can add bonus points from a client:

or from another workflow:

Of course, from there it's easy to enrich the workflow behavior, for example by adding actions when a user reaches different threshold points.

@Ignore annotation

The @Ignore (io.infinitic.annotations.Ignore) annotation lets us tag properties that are not part of the workflow state and should not be serialized during the workflow execution.

Service stubs, Workflow stubs and Channels are automatically ignored and are not saved with the workflow state.

Previous
Parallelization