Controlling calls to unreliable service

Hey folks! For our first use case with Temporal, we need to communicate with the API of an external vendor. This vendor opaquely (to us) limits our throughput, so we don’t really know we’re hitting it until we start getting errors. To prevent this, we’d like to control how much we’re interacting with this service. So my question is:

  • How can we control the parallelism or throughput of a single activity (or set of activities)? Can we limit parallelism to a fixed number somehow? What are our options here? And how could we dynamically do this at runtime?

We’re planning to run our workers in a managed kubernetes cluster on AWS.

Any guidance would be greatly appreciated. Thanks!

For Java SDK WorkerOptions configs:

  • maxActivitiesPerSecond - this is a worker specific rate limit of activities
  • maxConcurrentActivityExecutionSize - this is a worker specific limit on number of parallel activities
  • maxTaskQueueActivitiesPerSecond - this is a global task queue limit across all the workers listening on that task queue

For your case you can execute this specific activity on its own task queue and rate limit it using maxTaskQueueActivitiesPerSecond.