Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

282
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda