Skip to main content

HSMOD.REST.Async.API

class HSMOD.REST.Async.API

API class containing methods to trigger background jobs and to obtain status of existing jobs.

Method Inventory

Methods

classmethod DeleteJobRecordKey(pKey As %String)
Deletes an instance of HSMOD.REST.Async.JobRecord that is uniquely referenced by pKey. @API.Method
@Argument pKey Unique reference to an instance of HSMOD.REST.Async.JobRecord.
classmethod DeleteOldJobs(pTargetClass As %Dictionary.Classname, pTargetMethod As %Dictionary.Identifier, pAgeInSeconds As %Integer)
Deletes old jobs for a specified target class and method, based on age in seconds.
@API.Method
@Argument pTargetClass Class name originally passed to RunInBackgroundAndReturnJobKey().
@Argument pTargetMethod Method name originally passed to RunInBackgroundAndReturnJobKey().
@Argument pAgeInSeconds Age, in seconds, beyond which we will delete the job on the basis of being expired.
classmethod GetJobRecordFromKey(pKey As %String) as HSMOD.REST.Async.JobRecord
Returns an instance of HSMOD.REST.Async.JobRecord that is uniquely referenced by pKey. Returns a null oref if no object found.
@API.Method
@Argument pKey Unique reference to an instance of HSMOD.REST.Async.JobRecord.
classmethod GetJobRecords(pSearchCriteria As %Library.DynamicObject = {{}}) as %Library.ListOfObjects
Returns all available instances of HSMOD.REST.Async.JobRecord based on the provided search criteria.
@Argument pSearchCriteria Key-value pairs of search criteria.
{ "where": "Classname LIKE 'HS.FHIRServer.%' and Namespace = ?", "args": ["HSFHIR"], "order_by": "StartTime" }
classmethod RunInBackgroundAndReturnJobKey(pClassname As %Dictionary.CacheClassname, pMethodName As %Dictionary.CacheIdentifier, pArguments...) as %String
Runs pMethodName from class pClassname in a new job, via the JOB command. Records job information in a persistent object (an instance of HSMOD.REST.Async.JobRecord).
Returns the key to use to access the job information.
Job information can be accessed by calling GetJobRecordFromKey(), passing the key in as an argument.
Output to IO (i.e., via "write") is placed into the JobRecord's "WrittenOutput" property.
The specified method MAY have a return value of a %Library.DynamicAbstractObject, in which case that object will be serialized as JSON and stored in the JobRecord's "Result" property as a stream.
Throws exceptions.
@API.Method
@Argument pClassname Class of method to run in background.
@Argument pMethodName Method to run in background. Should be a classmethod, not an object method.
@Argument pArguments... Arguments to pass to the method.

Subclasses

FeedbackOpens in a new tab