Can Signal trigger Activity and keep strict order?

You don’t need an annotation. What you are asking is a synchronized block that works inside the workflow. You can easily mimic this with Workflow.await and a variable:

    boolean signalLock = true;

    @Override
    public void waitForName(String name) {
      Workflow.await(() -> signalLock);
      signalLock = false;
      try {
         // process signal
         ...
      } finally {
        signalLock = true;
      }
    }

Obviously the above can be easily encapsulated in a nice class.

1 Like