I have a use case that I am unable to model deterministically. Scenario works normally, but fails during replay.
I need to model a work distribution pattern where workflows produce and the work gets processed at external REST services. The Rest APIs are dynamic - they register to pull work and can execute work one after the other(throttles the number of calls made to that system).
This external workers were modelled with as a workflow with a queue and a while loop.
while (true) {
Workflow.await(() -> (queue.peek() != null);
//This availability is NOT DETERMINISTIC, so fails during replay.
if(registeredServices.available()){
ExecutionWorkflow child = Workflow.newChildWorkflowStub(ExecutionWorkflow.class, childWorkflowOptions);
child.runChild(queue.pop);
}
}
A group of rest APIS need to pull work when they are available(registeredServices).
Are there any patterns to model this?