Sync or Async activity or Signal for long running activities

Hello,

I have multiple microservices. My workflow is hosted by Microservice1.

This is what my workflow looks like -

  1. Activity 1 - Calls Microservice2 that can take a long time to return result
  2. Activity 2 - Can only proceed when Activity1 is successful. After that, it needs to communicate with Microservice3. This service gets a lot of requests from different services and needs to process the requests in order.
  3. Activity 3 - Updates the DB with with the result from Activity2

What would be the most effective way to implement these activities?

Since Microservice3 needs to process requests in order, does it make sense to put a message in a Kafka queue? If so, what’s the best way to get a response back? Through a signal or a response in the Kafka queue as well?

Should these activities (Activity1 and Activity2) be asynchronous activities waiting for a Future to return as they are long running?

Thanks!

  1. The simplest solution is to host an activity directly in the MIcroservice2. Otherwise, use an activity to initiate the request in Microservice2 and use a signal to report the result.
  2. How do you define the order of requests when they come from different services? Do you have some sort of global counter?

Thanks for your reply Maxim!

  1. Microservice2 will most probably not use Temporal (at least in Phase 1), so it cannot host an activity there and it will not be able to send a signal.
    I was thinking more in terms of asynchronous activity. Does that sound like a feasible solution?
  2. This is still in design phase, so not sure.

The reason for having a Kafka queue in Microservice3 (instead of Activity) is that some other services will be also be monitoring the response and not all of them use Temporal.
Is there any documentation I can refer to for integration with Kafka?

Thanks

  1. Then Microservice1 can expose a synchronous API that Microservice2 would use to communicate the completion of its operation.
  2. I don’t think there is a special Kafka documentation. The standard pattern is to listen to messages from Kafka and signal workflows based on them.