The Processor helps automating the task of processing a list of requests, and updates the log automatically with all operations performed.
A Processor splits the processing of requests into different flows. Each Flow
will process
the requests that return true for a given filter function that is specified when creating the
flow. For example, you can create one flow for requests of type "purchase", another for the
ones of type "cancel", etc.
Then, each flow consist of a series of steps, where each step is a function that receives
the flow itself as argument (so you can subclass Flow
and add steps as instance methods).
Once all flows have been defined, you must call the Processor.processAssetRequests
,
Processor.processUsageFiles
, or Processor.processTierConfigRequests
method to process
requests, depending on the type you want to process.
If an exception is thrown on any step, the rest of the steps will be skipped, and the next time the Processor runs, the request will be processed again.
You can check the examples
folder of the SDK to check how to use the Processor in the
supported target languages.
Constructor
Methods
flow(flow:Flow):Processor
Defines a flow of this
Processor. Steps in the are executed sequentially by the Processor
when its run
method is invoked for all the requests that return true
in the filter
function passed in the creation of the flow.
Parameters:
flow | The flow to add to the processor. |
---|
Returns:
this
Processor, so calls to this method can be chained.
processAssetRequests(filters:Query):Void
Processes all AssetRequest
objects that match the given filters,
executing in sequence all the flows defined for them.
Parameters:
filters | Filters to be used for listing requests. It can contain
any of the filters specified for the |
---|
processListings(filters:Query):Void
Processes all Listing
objects that match the given filters,
executing in sequence all the flows defined for them.
Parameters:
filters | Filters to be used for listing requests. It can contain
any of the filters specified for the |
---|
processTierConfigRequests(filters:Query):Void
Processes all TierConfigRequest
objects that match the given filters,
executing in sequence all the flows defined for them.
Parameters:
filters | Filters to be used for listing requests. It can contain
any of the filters specified for the |
---|
processUsageFiles(filters:Query):Void
Processes all UsageFile
objects that match the given filters,
executing in sequence all the flows defined for them.
Parameters:
filters | Filters to be used for listing requests. It can contain
any of the filters specified for the |
---|