Multiple updates, esp: Use "run as" property to manage workers
This is a collection with many little cleanups+fixes. However, there's one major update -- it adds support for setting the active user while processing a task.
== Before
Identities are not used. All tasks are assigned to the same context, even if they have different identities.
Tasks that require a specific identity requirement (runAs=>[domainId=>1,contactId=>100]) are likely to fail.
== After
Tasks are dispatched to PipeConnections in a way that respects runAs requirements.
- Each
PipeConnectionwill only be given tasks for a single identity (e.g.[domainId=>1, contactId=>100]ord1-c100). - When setting up a
PipeConnection, it will login with the appropriate identity. - If you have a dozen consecutive tasks for the same identity, then it is permitted to re-use
PipeConnections for different tasks (subject to theConfigurationlimits on #workers/#tasks/duration/etc). - If you have a dozen consecutive tasks with many different identities, then old/idle
PipeConnectionswill close - and new ones will start (subject to theConfigurationlimits on #workers/#tasks/duration/etc).