Message Classes
Here we will go over the primary message classes in use by JobFlow.
Message Envelope Class
Generally, all the messages sent and received by JobFlow are encapsulated within a Message<T>
envelope. The exception is the Web API endpoints - they take the object types directly (see the Web Api Documentation for more information).
Job Work Request Class
The Job Work Request message is sent to workers for processing. It consists of JobModel and Document.
Note that the Data
property of JobModel is defined as a JObject
. This lets you used a fully defined object for properties, which can be serialized with the myObj.ToJObject()
extension method. Since JObject
also implements an IDictionary
interface, properties can be set the same as a standard dictionary:
jobWorkRequest.Job.Data["MyProperty"] = "value";
Job properties are persisted to the attachment data store so they are available even during scheduled and retry operations.
See SystemJobProperties for system-defined Job properties that are available.
Job Work Response Class
The work response class is sent back to JobFlow from a worker once processing is finished.
Taking a look at the Status property:
Failure
will cause the Job to log an error and suspend. It is recommended you also provide aJobResponseMessage
detailing the cause of the failure.Retry
will cause JobFlow to reschedule the Job according to a configurable schedule (See Retry Options). If theProperties
dictionary contains the propertyRetryDelay
, it's value is used instead. Once the job has be retried a configured number of times, it'll will instead be processed as aFailure
.
The Messages property contains any status messages that will be recorded in the JobFlow database and are useful for debugging and tracing purposed - especially if there worker finished with an error.