Job System Workflow
Describes how jobs are processed with regard to retries, error conditions, etc.
There are actually two types of task as far as the job system is concerned. Jobs that create a shipment as part of their processing and jobs that do not. As of April 06, jobs that ship (transmit releases to retailers) do not create shipments (but act on previously created shipments). Jobs that prepare or package shipments do create shipments and more fully utilize the job systems workflow features.
The reason for this is partly historical; it's
the way the system was designed when I found it. And partly
pragmatic; two big use case families for the app are preparing
releases for shipping and then shipping them.
At bottom a shipment
is nothing more than a collection of releases that is to be acted on. A
shipment is always bound up with a specific job, and has a status with
regard to that particular job. The status values are arbitrary,
though certain ones arecconventially used in most packager/shipper
combinations.
The important thing about the packaging process is to ensure that each release has been acted on by every retailer job and that a release that has failed packaging is identified as such and is not acted again on by a packaging job. There's
one more twist to this, in that there may be multiple versions of a
release (aka a re-release) you can replace the release in the bolded
parts of the previous system with each version of a release.
A release has another indicator, complete. This is a sign
from the client application that a release is ready to be packaged and
shipped to all appropriate retailers. Packager jobs pay attention
to this value, but one can imagine other system tasks that act of
packages that aren't ready.
It's the job of classes that fulfill the IExtractor to create shipments for a job. The following extractors have been created to accomodate common packaging tasks
ExtractInitialRelease creates a shipment for a particular job for all Releases associated with that retail account, that are complete, and do not have a ReleaseVersion JobRecord for version 1 releases.
ExtractReReleases creates a shipment for a particular job for all Releases
associated with that retail account, that are complete, and do not have
a ReleaseVersionJobRecord for releases greater than version 1.
ExtractAllReleases is similar the above put creates a shipment for releases with any version number.
All
the above extractors do one more thing. They actually return a
list of shipments and not just a single one. This is in case the
shipment was shut down after a shipment was created but before it was processed. So it's possible that a job will work over a set of shipments, however, if the system is working properly this should rarely happen. An alternative would be to aggregate all extracted releases into a single current shipment. That would probably be the more elegant to handle this use case, but we don't for primarily historical reasons (it's the way things worked when I inherited it).