I have a task that exceeds more than 10 minutes deadline of the Task Queue. Going through different documentations, I found that using modules I could run an instance that would process the long running task but preferably even that should be done using the task queue. I had used backends but they are deprecated.
My question is how do I introduce Modules into my existing App Engine Project and how do I use them to run long-running tasks?
Following is the piece of code :
Queue queue = QueueFactory.getQueue("myqueue");
TaskOptions task = TaskOptions.Builder.withUrl("/submitworker").method(Method.POST);
queue.add(task);
What changes do I have to make in the above code to add a long-running task using a module? [The "submitworker" is a servlet which is the actual long running task]
I had referred this link, but I am unable to get around with the third step:
3. Add service declaration elements to the appengine-application.xml file.
Also, even if I successfully add a module to my project, how can I target this module using Task Queue?
I had gone through this question, but it is a python implementation, my implementation is in Java.
I am looking for a step by step process on how do I use "Target" in the modules and how to use it while adding to the task queue.
Even if I add the long-running module target to the task queue, still would it terminate the execution after 10 minutes or will it complete the task even if the task in the task queue expires?
Please suggest.
Modules and Services are the same thing, they're similar to the old backends (which still work, but are deprecated).
There are two basic ways of getting modules to work:
The second option is probably easier, because it's just a matter of changing your application-web.xml. You could have a repo or branch per module, or just a build process that changes the module you're targeting.
Right now your application-web.xml probably has something like this:
change it to something like this
You configure the queue itself to target a specific module in
queue.xml
See here.