we want to use our workflow to create some tickets, and the workflow need to listen to updates of those tickets, once we receive enough approvals from those tickets, the workflow can move forward
listen to updates means subscribe to live stream events (e.g kafka consumer)
we have 2 implementation plan, can you give us advices on it
we can create a web service that actively listens to the streaming events and send signal to workflows, then the workflow can use the wait_condition to receive signal from this service;
The alternative solution is making the workflow subscribe to the streaming event directly
the second question is what if the stream event is down, the workflow therefore miss some events and we don’t have alternative ways to load those missing events
would it be ok if we make wait_condition retryable to solve this issue
the wait_condition will timeout after waiting for a week
before retry, the workflow will send a message to engineer to manually look into the issue
the wait_condition will be retry
engineer look into the issue and realize this is due to missing streaming events, engineer can manual send a signal to let wait_condition pass
if we want to implement this, should we
create a separate child workflow to just make the wait_condition retryable without need to rerun the entire parent workflow
and we can set timeout for wait_condition to make the child workflow fail if it waits for too long
if the child workflow error out due to timeout, we use the retry policy to rerun the child workflow
Why do you need a webservice or Kafka? What component is notifying about ticket state changes? Can it call Temporal signal API directly?
Can you have an activity that checks for missing events? Then, you can wait for new events and, in parallel, run that activity periodically to perform the check.
reate a separate child workflow to just make the wait_condition retryable without need to rerun the entire parent workflow
This doesn’t require a child workflow. You can write a loop inside the parent to implement this logic.
the ticket is created by the company internal infra; and the only way to get update is via subscribing to the live stream (very similar to kafka), and the internal infra wouldn’t send signal to workflow directly; and if the live stream is down, we can’t fetch the missed events. at this case, we will need human intervene (though this should be very rare case)
our workaround is to create a separate web service (implementation plan 1) to subscribe to the live stream and then send a signal to our workflows
alternative workaround is to let workflow subscribe to the livestream directly, but the ticket would be open for 1-2 weeks, we will have 50 workflow has open live stream connection, we think this might be a bad practice
how do we loop the wait_condition without making it a child workflow?
approval_received = 0
while approval_received < 2:
workflow.wait_condition(approval_received<2, timeout=2weeks)
my understanding is if the timeout of wait_condition is reached, the entire workflow will fail right? and we have to retry the entire workflow right, what if we just want to
send a message to engineer to investigate
retry workflow.wait_condition
engineer can manual send a signal to make workflow.wait_condition pass.