Stay organized with collections
Save and categorize content based on your preferences.
publicfinalclassTaskOptionsimplementsSerializable
Contains various options for a task following the builder pattern. Calls to TaskOptions
methods may be chained to specify multiple options in the one TaskOptions object.
taskOptions can have either TaskOptions.Method PULL or a PUSH-related method, e.g.
POST, GET, ... Tasks with PULL method can only be added into a PULL queue and PUSH tasks can only
be added into a PUSH queue.
Notes on usage:
The recommended way to instantiate a TaskOptions object is to statically import Builder.* and invoke a static creation method followed by an instance mutator (if needed):
Sets the dispatch deadline for a task. The dispatch deadline should be no smaller than
TaskOptions#MIN_DISPATCH_DEADLINE and no larger than TaskOptions#MAX_DISPATCH_DEADLINE.
Returns the dispatch deadline for a task. The dispatch deadline determines how long the of a
task should take. If a task exceeds its deadline, it will be canceled and retried based on
retry configurations of the task and/or queue.
Sets the payload directly without specifying the content-type. If this task is added to a push
queue, the content-type will be set to 'application/octet-stream' by default.
Sets the payload to the serialized form of the deferredTask object. The payload will be
generated by serializing the deferredTask object using ObjectOutputStream#writeObject(Object). If the deferredTask's Method is not PULL, the
content type will be set to DeferredTaskContext#RUNNABLE_TASK_CONTENT_TYPE, the method
will be forced to Method#POST and if otherwise not specified, the url will be set to
DeferredTaskContext#DEFAULT_DEFERRED_URL; the DeferredTask servlet is, by
default, mapped to this url.
Note: While this may be a convenient API, it requires careful control of the serialization
compatibility of objects passed into #payload(DeferredTask) method as objects placed in
the task queue will survive revision updates of the application and hence may fail
deserialization when the task is decoded with new revisions of the application. In particular,
Java anonymous classes are convenient but may be particularly difficult to control or test for
serialization compatibility.
Set the payload by String. The charset to convert the String to will be UTF-8 unless
the method is PULL, in which case the String's bytes will be used directly.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-05 UTC."],[[["`TaskOptions` is a class that provides various options for configuring tasks, using the builder pattern for specifying multiple options in a single object."],["Task options can be set for either PULL or PUSH queues, using methods like `TaskOptions.Method` for PULL and POST, GET, etc. for PUSH, with each type only being compatible with its own specific queue type."],["The recommended way to create a `TaskOptions` object is to statically import `Builder.*` and use a static creation method, followed by any necessary instance mutators."],["`TaskOptions` include methods to manage parameters, headers, payload, execution time (ETA), dispatch deadlines, and retry options of tasks, providing comprehensive control over task behavior."],["The class also includes a copy constructor, and methods to set or get the task's name, tag, and url, as well as inherited members from `Object`, and it implements `Serializable`."]]],[]]