Dynamic activities registration at runtime and worker splitting

  • Is it better, on a single node, to run multiple workers with a unique workflow or one worker with many workflows listeners

We recommend one worker with many workflow types. It is more efficient and allows configuring limits (like a number of parallel executions) for all of them together. In some rare situations, some workflows might require separate limits which might require a separate worker. But it shouldn’t be a default.

No need to load activity types into workflows. Just invoke activities by their string names for those use cases. Here is how to invoke an activity by its name:

 ActivityStub stub =
        Workflow.newUntypedActivityStub(
            ActivityOptions.newBuilder().setStartToCloseTimeout(Duration.ofMinutes(1)).build());
    stub.execute("activityName", ResultClass.class, args);