I have a following use case and not sure how to go about implementing it
- I have a activity ( a1) which which is emitting a kafka event and waiting for async completion, this event is consumed by another service which calls back my service resulting into creation of a workflow .
- This workflow has an activity (a2) which is waiting for a signal from external event ( I have a kafka consumer which async completes this activity ) .
I want to complete both activity a1 and a2 simultaneously is this possible ?
Are steps 1 and 2 performed by different workflows? These steps seem sync so wondering if its possible to have a single workflow that invokes a1 and waits for a signal from your callback endpoint, cancels the activity and starts a2 and waits again for second signal.
Let me know if I’m missing something.
hey @tihomir thanks for your reply , Yes these are part of different workflow. To simplify lets say there are two workflows w1 (which has activity a1 )and w2 ( which has a2 )
w1 → creates a1 , this activity calls another service which might take some time to process the request made by a1, so it needs to wait till this event is processed .
When the event is processed by external service, the service invokes a grpc endpoint of my service which processes the request by creating a workflow i.e ( w2 ) . w1 and w2 are two different workflows and cannot be combined as they serve different purpose . Now w2 has a2 which again calls a external service for approval . Once the request is approved I am completing a2 in a async manner , but I also want to complete a1 which is waiting for the same request to complete . So TLDR both activities are waiting on same request completion .
Ok so we have (w=workflow, a=activity, s=service)
When you make the call from a1 to s1, is it possible to pass the the w1 workflow id which then is returned as part of response from s1 to s2 (which starts w2)?
If this is possible you could pass the w1 workflow id to w2, and after a2 receives the completion signal from s3 you could send signal from w2 to w1 that would denote request completion. If you dont get this signal within X time you could invoke a1 in w1 again if needed.
It is possible to do async activity completion by workflow and activity id (and not just token) but think signals may be better for this use case.
Hey @tihomir , thanks !!! that seems to be doable, I was wondering how would async activity completion might look like instead of workflow signals ( we currently have all the require code for async activity completion in place )
Once the request is approved I am completing a2 in a async manner
Is s3 completing a2?
I was wondering how would async activity completion might look like instead of workflow signals
Think you would have to pass the task token (or w1 wfid and a1 activity id) in w1 all the way to w2 and complete it from there.
Yes, I have a kafka consumer set in my service which gets an event from s3 and then completes a2 .