Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

279
Views
How to set MAX_ATTEMPTS from code to Google Cloud Task?

How to set MAX_ATTEMPT of the tasks in google cloud queue in code?

When I create new task, I want to set how many repetitions of a given task should be, can I do it from the code below?

I have google cloud queue like here:

const {CloudTasksClient} = require('@google-cloud/tasks');
const client = new CloudTasksClient();

async function createHttpTask() {
  const project = 'my-project-id';
  const queue = 'my-queue';
  const location = 'us-central1';
  const url = 'https://example.com/taskhandler';
  const payload = 'Hello, World!';
  const inSeconds = 180;

  const parent = client.queuePath(project, location, queue);

  const task = {
    httpRequest: {
      httpMethod: 'POST',
      url,
    },
  };

  if (payload) {
    task.httpRequest.body = Buffer.from(payload).toString('base64');
  }

  console.log('Sending task:');
  console.log(task);
  const request = {parent: parent, task: task};
  await client.createTask(request);
}
createHttpTask();

From the Google Cloud Documentation i see that I can do it from the console, for the whole queue - https://cloud.google.com/tasks/docs/configuring-queues#retry , but I want to set this dynamically for the tasks

thanks for any help!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Unfortunately, the answer is no. You can not set retry parameters on individual tasks. I make this claim by looking at this document:

REST Resource: projects.locations.queues

which is the REST API for creating task queues. In there, under the documentation for retryConfig we read:

For tasks created using Cloud Tasks: the queue-level retry settings apply to all tasks in the queue that were created using Cloud Tasks. Retry settings cannot be set on individual tasks.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!