Workflow strategy for multiple interactions with the world

Hello everyone,

Thanks to all the contributors on this project, you did an amazing job and I am excited to develop my next project using Temporal.

I need some tips & tricks in terms of the best strategies for implementing a workflow that interacts with the world multiple times. The project that I am building should handle the following in a typical workflow:

  • Sleep for a predefined amount of time.
  • Fetch credentials from a trusted source.
  • Check whether the credentials are still valid, if not then notify the system + have a retry mechanism.
  • Use the credentials to interact with a different service.

With this system in mind, here are my questions:

  • Would each step (except for the sleep) be a separate Activity or would it make sense to handle everything directly from the Workflow?
  • How would it be best to handle the errors if a request to an external service fails?

Thank you so much for your time and help!

  • Would each step (except for the sleep) be a separate Activity or would it make sense to handle everything directly from the Workflow?

Yes, interactions with your credentials provider for fetching/validating certs, and interacting with the different services should be done via activities.

  • How would it be best to handle the errors if a request to an external service fails?

One way would be to poll this service, see forum post here (associated java code samples here if it helps).