#[non_exhaustive]pub struct Task {
pub name: String,
pub schedule_time: Option<Timestamp>,
pub create_time: Option<Timestamp>,
pub dispatch_deadline: Option<Duration>,
pub dispatch_count: i32,
pub response_count: i32,
pub first_attempt: Option<Attempt>,
pub last_attempt: Option<Attempt>,
pub view: View,
pub message_type: Option<MessageType>,
/* private fields */
}Expand description
A unit of scheduled work.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: StringOptionally caller-specified in CreateTask.
The task name.
The task name must have the following format:
projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID
PROJECT_IDcan contain letters ([A-Za-z]), numbers ([0-9]), hyphens (-), colons (:), or periods (.). For more information, see Identifying projectsLOCATION_IDis the canonical ID for the task’s location. The list of available locations can be obtained by calling [ListLocations][google.cloud.location.Locations.ListLocations]. For more information, see https://cloud.google.com/about/locations/.QUEUE_IDcan contain letters ([A-Za-z]), numbers ([0-9]), or hyphens (-). The maximum length is 100 characters.TASK_IDcan contain only letters ([A-Za-z]), numbers ([0-9]), hyphens (-), or underscores (_). The maximum length is 500 characters.
schedule_time: Option<Timestamp>The time when the task is scheduled to be attempted or retried.
schedule_time will be truncated to the nearest microsecond.
create_time: Option<Timestamp>Output only. The time that the task was created.
create_time will be truncated to the nearest second.
dispatch_deadline: Option<Duration>The deadline for requests sent to the worker. If the worker does not
respond by this deadline then the request is cancelled and the attempt
is marked as a DEADLINE_EXCEEDED failure. Cloud Tasks will retry the
task according to the RetryConfig.
Note that when the request is cancelled, Cloud Tasks will stop listening for the response, but whether the worker stops processing depends on the worker. For example, if the worker is stuck, it may not react to cancelled requests.
The default and maximum values depend on the type of request:
-
For HTTP tasks, the default is 10 minutes. The deadline must be in the interval [15 seconds, 30 minutes].
-
For App Engine tasks, 0 indicates that the request has the default deadline. The default deadline depends on the scaling type of the service: 10 minutes for standard apps with automatic scaling, 24 hours for standard apps with manual and basic scaling, and 60 minutes for flex apps. If the request deadline is set, it must be in the interval [15 seconds, 24 hours 15 seconds]. Regardless of the task’s
dispatch_deadline, the app handler will not run for longer than than the service’s timeout. We recommend setting thedispatch_deadlineto at most a few seconds more than the app handler’s timeout. For more information see Timeouts.
dispatch_deadline will be truncated to the nearest millisecond. The
deadline is an approximate deadline.
dispatch_count: i32Output only. The number of attempts dispatched.
This count includes attempts which have been dispatched but haven’t received a response.
response_count: i32Output only. The number of attempts which have received a response.
first_attempt: Option<Attempt>Output only. The status of the task’s first attempt.
Only dispatch_time will be set. The other Attempt information is not retained by Cloud Tasks.
last_attempt: Option<Attempt>Output only. The status of the task’s last attempt.
view: ViewOutput only. The view specifies which subset of the Task has been returned.
message_type: Option<MessageType>Required. The message to send to the worker.
Implementations§
Source§impl Task
impl Task
pub fn new() -> Self
Sourcepub fn set_schedule_time<T>(self, v: T) -> Self
pub fn set_schedule_time<T>(self, v: T) -> Self
Sets the value of schedule_time.
Sourcepub fn set_or_clear_schedule_time<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_schedule_time<T>(self, v: Option<T>) -> Self
Sets or clears the value of schedule_time.
Sourcepub fn set_create_time<T>(self, v: T) -> Self
pub fn set_create_time<T>(self, v: T) -> Self
Sets the value of create_time.
Sourcepub fn set_or_clear_create_time<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_create_time<T>(self, v: Option<T>) -> Self
Sets or clears the value of create_time.
Sourcepub fn set_dispatch_deadline<T>(self, v: T) -> Self
pub fn set_dispatch_deadline<T>(self, v: T) -> Self
Sets the value of dispatch_deadline.
Sourcepub fn set_or_clear_dispatch_deadline<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_dispatch_deadline<T>(self, v: Option<T>) -> Self
Sets or clears the value of dispatch_deadline.
Sourcepub fn set_dispatch_count<T: Into<i32>>(self, v: T) -> Self
pub fn set_dispatch_count<T: Into<i32>>(self, v: T) -> Self
Sets the value of dispatch_count.
Sourcepub fn set_response_count<T: Into<i32>>(self, v: T) -> Self
pub fn set_response_count<T: Into<i32>>(self, v: T) -> Self
Sets the value of response_count.
Sourcepub fn set_first_attempt<T>(self, v: T) -> Self
pub fn set_first_attempt<T>(self, v: T) -> Self
Sets the value of first_attempt.
Sourcepub fn set_or_clear_first_attempt<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_first_attempt<T>(self, v: Option<T>) -> Self
Sets or clears the value of first_attempt.
Sourcepub fn set_last_attempt<T>(self, v: T) -> Self
pub fn set_last_attempt<T>(self, v: T) -> Self
Sets the value of last_attempt.
Sourcepub fn set_or_clear_last_attempt<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_last_attempt<T>(self, v: Option<T>) -> Self
Sets or clears the value of last_attempt.
Sourcepub fn set_message_type<T: Into<Option<MessageType>>>(self, v: T) -> Self
pub fn set_message_type<T: Into<Option<MessageType>>>(self, v: T) -> Self
Sets the value of message_type.
Note that all the setters affecting message_type are mutually
exclusive.
Sourcepub fn app_engine_http_request(&self) -> Option<&Box<AppEngineHttpRequest>>
pub fn app_engine_http_request(&self) -> Option<&Box<AppEngineHttpRequest>>
The value of message_type
if it holds a AppEngineHttpRequest, None if the field is not set or
holds a different branch.
Sourcepub fn set_app_engine_http_request<T: Into<Box<AppEngineHttpRequest>>>(
self,
v: T,
) -> Self
pub fn set_app_engine_http_request<T: Into<Box<AppEngineHttpRequest>>>( self, v: T, ) -> Self
Sets the value of message_type
to hold a AppEngineHttpRequest.
Note that all the setters affecting message_type are
mutually exclusive.
Sourcepub fn http_request(&self) -> Option<&Box<HttpRequest>>
pub fn http_request(&self) -> Option<&Box<HttpRequest>>
The value of message_type
if it holds a HttpRequest, None if the field is not set or
holds a different branch.
Sourcepub fn set_http_request<T: Into<Box<HttpRequest>>>(self, v: T) -> Self
pub fn set_http_request<T: Into<Box<HttpRequest>>>(self, v: T) -> Self
Sets the value of message_type
to hold a HttpRequest.
Note that all the setters affecting message_type are
mutually exclusive.