Home > Class Reference > %SYS namespace > %SYSTEM.WorkMgrIPQ


donotuse class %SYSTEM.WorkMgrIPQ extends %SYSTEM.IPQSet, %SYSTEM.WorkMgr

Method Inventory (Including Private)

Methods (Including Private)

method Decode(qspec As %String, ByRef AtEnd As %Boolean) as %Status
This is called when the data received from the IPQ is "" in order to return any error information or output anything to the current device and to take care of book keeping. It will set AtEnd if we are at the end of the data and will run any callback methods and will return to the caller.
method Queue(work As %String, args... As %String) as %Status
Queues a specific unit of work, 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. The item called will communicate back to this process by writing to the interprocess queue:
  ; From worker job put data on the IPQ to send back to the main process
  Set len=($system.Context.WorkMgr().IPQ).Put(data)
The 'data' can be anything wanted as long as it is not "" as this is used as a signal that we have worker status information. Often it will be a $listbuild of some information. The master process reads from the queue with:
  Set atend=0
  While 'atend {
  	Set data=workqueue.Get(timeout)
  	If data="",workqueue.SessionNum'=0 {
  		Set sc=workqueue.Decode(,.atend) If $$$ISERR(sc) ; Handle error
  	} Else {
  		; Process data returned
As can be seen if data="" and this is not a timeout (SessionNum=0) this signals some output from a worker job or an error in the worker job so the Decode() must be called to handle this. 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.