Cloud Tasks
1. Cloud Tasks
Cloud Tasks lets you manage the execution, dispatch, and delivery of large numbers of distributed tasks. A task is a piece of work that can be processed independently by dispatching it to an HTTP service. You can set up a queue for tasks that will be sent to a particular service. A task added to this queue will be automatically dispatched to your chosen HTTP service. The returned status code indicates whether the task has been completed successfully or should be retried. When sending a task to a queue, you can schedule the task to be dispatched at a specified future time. You can configure the queue with a maximum rate to dispatch tasks or a maximum number of tasks that can be dispatched concurrently. You can also specify the maximum number of attempts and the delay between attempts when tasks are retried. Cloud Tasks also guarantees at-least-once delivery and eliminates any duplicate tasks that are created. HTTP services that require authentication may be called by automatically attaching a token associated with the service account of the application creating the task. Although Cloud Tasks and Pub/Sub are conceptually similar, both implementing message passing and asynchronous integration, they are designed for different use cases. With Cloud Tasks, the task creator uses explicit invocation, where the creator retains full control over the execution and destination of the task. The creator places the task in a queue attached to a specified endpoint, and the creator can defer the dispatching of the task. With Pub/Sub, the message publisher uses implicit invocation. The publisher implicitly causes any subscribers to execute by publishing the message, but the publisher has no control over which subscribing services receive the message. Cloud Tasks is appropriate for use cases where an application wants to asynchronously execute a specific service, and possibly control the timing of the execution. Pub/Sub should be used for event-based architectures that rely on receiving services reacting to events generated by other services. Cloud Tasks does a great job of separating out independent pieces of work to be processed asynchronously. Slow background operations can be offloaded to a separate worker, reducing the work required by the main application and improving response time. Unlike Pub/Sub, the application retains control of the execution, specifying the endpoint to handle the offloaded task. Cloud Tasks lets you configure retries, scheduling, and rate limiting.2. Let's practice!
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.