Integratec API Platform
Persistence

Table of Contents

The Master module also manages a database for persisting records of jobs and requests. This management and the associated services are generally referred to as Persist.

The initially serialized data, stored and managed via Integratec Persist services, consists of two primary components: tasks and jobs.

Tasks

A Persist Task is a self-contained serialized service request, containing both the Service identifier and the structured RequestData. See the JSON-serialized Persist Task example below:

{
"name": "SetMaxTo250k",
"serviceId": "setBrokerRequestMax",
"requestData": {
"value": 250000
}
}

Jobs

A Persist Job is simply an array of Persist Task objects. See the JSON-serialized Persist Job example below:

{
"name": "SetMaxThings",
"tasks": [
{
"name": "SetMaxTo250k",
"serviceId": "setBrokerRequestMax",
"requestData": {
"value": 250000
}
},
{
"name": "GetNewMax",
"serviceId": "getBrokerRequestMax",
"requestData": {}
}
]
}

Usage

Persist provides four services:

  1. persistAddJob

    This service accepts an array of Tasks, parses it, and creates database records to represent the Job. Once a Job is created, it is identified by a JobID, and may be run whenever needed using persistRunJob, without having to specify anything other than the JobID.

    Note: Adding a Persist Job to the database does not start it.

  2. persistRunJob

    This service tells Persist to run the Job specified by JobID, which creates a JobRun and a TaskRun in the database for each Task in the Job. These "run" records are unique and allow you to retain an easy-to-reference work history.

    For example: api.sendRecvDelete("persistRunJob", "{ "JobID": 42 }")

  3. persistGet

    This service retrieves information from the database. The information retrieved is denoted by the getType property, which is required by the persistGet-req schema for all persistGet requests. Depending on getType, additional properties may be available and/or required. See the persistGet-req schema for more information.

    The following getType values are supported:

    • Job
    • Jobs
    • JobRun
    • JobRuns
    • TaskRun
    • TaskRuns
    • CountJobs
    • CountJobsByName
    • CountJobRuns

    For example: api.sendRecvDelete("persistGet", "{ "getType": "Job", "JobID": 42 }")

  4. persistDelete

    This service permanently removes information from the database. The information to be removed is denoted by the deleteType property, which is required by the persistDelete-req schema for all persistDelete requests. Depending on deleteType, additional properties may be available and/or required. See the persistDelete-req schema for more information.

    The following deleteType values are supported:

    • Job
    • JobsAll
    • JobRun
    • JobRunsByJobID
    • JobRunsAll

    For example: api.sendRecvDelete("persistDelete", "{ "deleteType": "JobRunsByJobID", "JobID": 42 }")

Database

The Jobs.sdb database is stored in the directory specified by the RemotePath configuration setting.

It contains four tables:

  • Job
  • JobRun
  • Task
  • TaskRun