1

I am trying to use Pull Queue on Google AppEngine, here is the setup

  • Users will create a task through my applications REST API
    • It then adds a Task to "TEST_QUEUE" (mode: PULL)
  • A Cron job will check the QueueStatistics to see if there are any pending tasks, and calculates number of workers to start and pushes the worker config (lease, number of tasks to fetch etc) to a Push Queue
  • In the Push Queue handler, i am doing some sanity checks and the issuing a leaseTasks Java API call
    • Here is the problem, this call is always returning empty array of TaskHandles.

I am testing this on AppEngine infrastucture and only 1 handler is attempting to leaseTasks

This is how I am adding the task

Queue queue = QueueFactory.getQueue("TEST_QUEUE");
TaskOptions options = TaskOptions.Builder.withMethod(TaskOptions.Method.PULL)
                                 .payload("Test");

This is how i am trying to fetch the tasks

Queue queue = QueueFactory.getQueue("TEST_QUEUE");
Logger.info("Task Count (Before): " + queue.fetchStatistics().getNumTasks());
List<TaskHandle> handles = queue.leaseTasks(300, TimeUnit.SECONDS, 100);
Logger.info("Task Count (After): " + queue.fetchStatistics().getNumTasks());
Logger.info("Handles: " + handles);

I have 3 tasks in the "TEST_QUEUE" (confirmed this from the admin console as well)

Task Count (Before): 3
Task Count (After): 3
Handles: []

After this, the tasks no longer exist when i check in the admin console. I am wondering if someone seen this before or am i doing something wrong? Please advice

digerati
  • 85
  • 1
  • 5

1 Answers1

0

Ok... after a few trial and error attempts, i found the issue

The following was my queue.xml snippet for the queue mentioned above.

<queue>
    <name>TEST_QUEUE</name>
    <mode>pull</mode>
    <retry-parameters>
        <task-retry-limit>0</task-retry-limit>
    </retry-parameters>
</queue>

The problem was fixed after <retry-parameters> was removed from the above snippet. I was trying to convert this queue from a Push queue, so i neglected to remove this since Java Task Queue Configuration doesn't mention that this parameter is only for Push Queue

Hope this helps someone :)

digerati
  • 85
  • 1
  • 5