Simple Example 2

Following from our Simple 1 example, we will make a couple of changes to demonstrate how service calls into the runtime are decoupled from the business logic.

Referring to the service contract:

On GuestArrival, we will now emit a GreetingRequest. We will respond to this request with a Greeting. After this Greeting we will also arrange a coffee order for the person.

New entities are required:

The business logic is then updated to look like this:

As before, when a GuestArrival is provided through the service, the Greeting will be returned. In this case, the intermediary step will also be taken. As the result is returned, the runtime will continue to execute OnGreeting and the DrinkOrder will be created.

Under the hood this is performed by using a subscription service to wait for the appropriate result, which means the steps between the GuestArrival and the Greeting could be arbitrarily complex (subject to configured timeouts), and may wait on other information to be submitted. Each lambda method is also executed independently and transactionally. The full details are covered in Integration.

In essence, both storage and code execution in the domain you have defined is independent to your interaction with it.

These orders could be queried for later, or be picked up by subscriptions.

The concepts around context and lineage will be expanded on in the next example.