Question regarding non-deterministic errors following doing Training 102

Hi all,

having finished the training 102 course (java). I have a quick question to make sure I have my understanding of non-deterministic errors and temporal behaviour correct, with a real world example.


  1. Let’s say I am writing a financial application involving an exchange rate between two currencies.
  2. I define a workflow that calls two temporal activities:
    a) it retrieves a current FX rate (FXRateActivity)
    b) it executes the transaction using that FXRate (DoTxActivity - which is passed the rate from (a))

Now an FX rate is time dependant (ie it will change with time). So I have it executed by an activity.

I believe this code is deterministic as the commands will be issued in the same orders all the time.

However the actual result will vary depending on when it is run.

In this case, if I start the workflow and it were to crash after the FXRate Activity had completed successfully but before DoTxActivity is called.

If it were to be restarted 5 mins later, then my understanding is the tx will continue with the FXRate that was orignally returned (which was correct at the time the TX started, but is no longer current), and that execute will finish without a non-determinism error.

Is that correct?

That’s fine if it is, but that means the design of the workflow has to cater for a customer agreeing to an FX rate prior to doing DoTxActivity so they can’t complain at a later time if the rate moved subsequently.

Does all that make sense? Hope so.

Many thanks,

The simplest way to think about workflows is that they execute exactly once, but due to an outage, the time can jump ahead at any point of their execution. So, if it is important to ensure that the rate returned is still valid, you can include the time of FXRateActivity execution as an argument to DoTxActivity. Then, it could reject stale values and fail, and both activities can be retried from the beginning.

That’s as I thought.

Many thanks