Skip to main content


class %SYSTEM.ShardWorkMgr extends %SYSTEM.AbstractWorkMgr

Internal class to manage distributing work to other systems in a sharded environment. This is modelled on the %SYSTEM.WorkMgr as closely as possible. To use this you first create an instance of this class, this acts as the container for the units of work you then request. Finally you wait for this work to complete or return errors.

Method Inventory


method Broadcast(set As %String, work As %String, args... As %String) as %Status
Broadcast a task to be run via the Work Queue Manager on all systems that form part of set of machines. The set supports the following values for a sharding system:
  1. DS or data : All shard data nodes
  2. QD or compute : A set of shard compute/query nodes
  3. all : All shard nodes
Note that QD/compute will pick a set of compute/query nodes that cover the entire extent and run the broadcast on these nodes so it will be able to see all the data.

Returns a %Status code if the work was queued correctly, note that to see if the work completed you need to call Sync() method (formerly WaitForComplete()) and check the returned %Status value for this. The remote work is run in the namespace with the same name as the current namespace when the queue is created. You pass the entry point to call in work argument. This can be either '##class(Classname).ClassMethod' or '$$entry^rtn' and it is expected to return a %Status code on completion. If you want to call a function that does not return any value on completion then prepend the class syntax with '=' such as '=##class(Classname).ClassMethod' or for calling a function do not include the '$$' for example 'entry^rtn'. The item being called may also throw exceptions in order to indicate an error happened which is trapped and converted to a %Status value to be returned in the master process. You can also pass additional arguments including arrays by reference. Note that the size of the data passed in these arguments should be kept relatively small, if there is a large amount of information that needs to be passed then put this in a global. The security context of the caller is also recorded when this function is called so it can be used when the work is executed.

Inherited Members

Inherited Properties

Inherited Methods

FeedbackOpens in a new tab