Service Task Sets (service task multiplexing)
SHAR has functionality to optimise how the service task implementation uses NATS consumers.
By default, a NATS consumer is created per service task. This means that if there are 1000 service tasks, there will be 1000 NATS consumers, which unfortunately isn’t that scalable.
SHAR has the ability to group multiple related service tasks and have them all share a single NATS consumer. This means that if there are 1000 related/grouped service tasks, they can be served by one NATS consumer.
This can be enabled by defining an optional field in the service task specification called spec.metadata.serviceTaskSetName.
Setting this field to the same value across multiple service tasks will mean these service tasks will share the same NATS consumer which filters subjects based on this pattern
WORKFLOW.<namespace>.State.Job.Execute.Set.<serviceTaskSetName>.ServiceTask.<taskUid>
This behaviour is exercised in TestServiceTaskSet
Note that leaving out this field will use the default implementation of service tasks (ie A NATS consumer for each service task with the original service task subject pattern).