Jobs enable delayed and unattended execution in Topincs. Normally they are created in a service, but they are also used internally by chores – tasks that are repeated in regular intervals. If you are familiar with Unix, jobs are similar to at whereas chores are more like cron.
Some things just take time. Sending an email might take several seconds. Importing data might take several minutes or hours. When you do not want your user to wait for feedback that long, you need to create a service call and schedule it for later. You need to create a job.
API reference
You cannot use any service as a job. It needs to be a modifying POST service and have a txt representation for feedback when it runs successfully. Let us assume our requirements specify that once a wish is recorded, the child should be nofified via email. In this case you can use a form trigger and write:
<?php
$wish = Tobject::get($topic_id);
schedule("emailconfirmation", ["wish" => $wish]);
With this trigger in place the saving of the wish will be swift, since it does not wait for the SMTP communication to finish, and the service will be executed exactly once, even if the service execution fails, e.g. because the mail server cannot be reached. The job is always executed as the scheduling user, so that meta data will be correct.
Check it out
You can access the job overview at Admin menu > More > Jobs. There you have access to detailed information on jobs grouped by service. By default, the 500 newest jobs per service are displayed in a table.
Most importantly you can see the status of the job. An empty table cell means the job has not been executed. Once the job was executed (started and finished), the status will show either Ok or Error. The output column right after status shows the output of the service call, if implemented in the representational TXT component, or the error message.
This page cannot be displayed in your browser. Use Firefox, Opera, Safari, or Chrome instead.
Saving …