Document toolboxDocument toolbox

JobData

The JobData system allows medium sized data to be transferred between contracts. It is used by the mail system, EDI system and more, typically in situations where data is imported from a shared server (eg. the mail server) and then needs to be delegated to different contracts.

To store data for another contract, call:

JobData::toDB($contract, $data1, $data2, $modcode);

$data1 and $data2 are JSON encoded. The final length of $data1 is limited to 8 KB, for $data2 it is 64 KB.

The other contract may then retrieve it using:

foreach (JobData::getAllIds($mycontract, $modcode) as $id) {
  $data = JobData::get($id);
  $data1 = $data['subject']; // the underlying DB table was originally used for mails
  $data2 = $data['body'];
  JobData::removeDB($id);
}

Alternatively, you may call:

JobData::IPC($contract, $modcode, $data);

The job basic/ipc reads the data, so you only need to extend that job to handle the modcode.