Can anybody confirm Deferred task should work with settings in queue.xml?
On Apr 27, 11:28 am, Marcel Overdijk <marceloverd...@gmail.com> wrote: > Hi Gianni, > > If I understand correctly I can use the default handler for any > deferred task and thus specifying the url is irrelevant. > > How would I send a 'deferred' Task to a specific queue? Like this? > QueueFactory.getQueue("email- > queue").add(TaskOptions.Builder.withPayload(newEmailTask(email))); > > This seems to work indeed as > DeferredTaskContext.getCurrentRequest().getHeader("X-AppEngine- > QueueName") prints out the 'email-queue'. So that's great. > > Now I've added queue.xml to WEB-INF folder with: > > <queue-entries> > <queue> > <name>default</name> > <rate>1/s</rate> > <retry-parameters> > <min-backoff-seconds>1</min-backoff-seconds> > <task-retry-limit>5</task-retry-limit> > </retry-parameters> > </queue> > <queue> > <name>email-queue</name> > <rate>1/s</rate> > <retry-parameters> > <min-backoff-seconds>5</min-backoff-seconds> > <task-retry-limit>3</task-retry-limit> > </retry-parameters> > </queue> > <queue> > <name>other-queue</name> > <rate>1/s</rate> > </queue> > </queue-entries> > > I've done some testing and inside the task I just throw an Exception > to test the retry parameters. > > What I see is that the retry parameters are not picked up (at least in > Development server). > > I keeps trying (more than the 3 time retry limit) and the backoff > seconds are also not used. > I see the first 3 or 4 retries within 2 seconds or so, and interval > starts increasing, nut 5 between each retry. > > Could it be that the queue.xml is not picked up or I did something > wrong? > > Thanks for your help and patience, > Marcel > > On Apr 27, 12:09 am, Gianni Mariani <gian...@google.com> wrote: > > > > > > > > > On Wed, Apr 27, 2011 at 4:19 AM, Marcel Overdijk > > <marceloverd...@gmail.com>wrote: > > > > But is it possible to change queue settings for Deferred task? > > > A DeferredTask is just like any other task. There is no restriction on > > DeferredTasks with respect to queue settings or which queues you put them > > in. > > > The fact that a special handler exists for deferred task is inconsequential. > > It's just a simplification, in that you don't need to do that for yourself. > > i.e. if you do not specify a URL, it will work out of the box. The task is > > automatically set to the correct handler when you set the DeferredTask > > payload. > > > > Like a deferred Email task I would like to throttle differently then > > > anotther queue (using Deferred Task( > > > > So baically the questions are: > > > - With Deferred task, can you have multiple queues? > > > Like any task. You can add a deferred task to any queue. > > > > - Is it possible to change throttling configuration per Deferred task > > > queue? > > > DeferredTasks may be placed in any queue. > > > Just a note. You seem to be conflating handlers/servlet mappings with > > queues. There is nothing stopping you from having a single handler accept > > requests from any queue. > > > In the case of the TaskOptions.payload(DeferredTask) method, it will > > automatically set the handler url for you if it is not otherwise specified. > > URL is somewhat irrelevant for deferred task since the run() method you > > define is essentially the "entry point" for the task. > > > > On Apr 26, 4:59 pm, Gianni Mariani <gmari...@google.com> wrote: > > > > The preconfigured URL mapping for the DeferredTaskServlet may be used > > > > for any queue. There is no need to specify your own URL mapping that > > > > I can see. > > > > > On Apr 22, 8:05 pm, Marcel Overdijk <marceloverd...@gmail.com> wrote: > > > > > > I did some quick testing and I found out: > > > > > > QueueFactory.getQueue("email- > > > > > queue").add(TaskOptions.Builder.withPayload(new > > > > > EmailTask(email)).url("/email-queue")); > > > > > > that with above I can enqueue adeferredtaskin the another queue > > > > > (not default). > > > > > I had to to use the url("/email-queue") setting otherwise it was > > > > > pushed to the default __deferred__ handler. > > > > > > I just configured the > > > > > com.google.apphosting.utils.servlet.DeferredTaskServlet and mapped it > > > > > to /email-queue > > > > > > When I try System.out.println("queue name: " + > > > > > DeferredTaskContext.getCurrentRequest().getHeader("X-AppEngine- > > > > > QueueName")); > > > > > I see the correct e-mail-queue being printed thus so far everything > > > > > seems to work. > > > > > > I also configured <task-retry-limit>5</task-retry-limit> for this > > > > > queue but this does not seem to work. > > > > > > So the setup is working but the DeferredTask / DeferredTaskServlet do > > > > > not seem to look into the settings configured in queue.xml > > > > > > Can somebody confirm this? > > > > > Do you have more information on how you determined that this is not > > > > working? > > > > > > On Apr 22, 11:13 am, Marcel Overdijk <marceloverd...@gmail.com> wrote: > > > > > > > Maybe use additional mappings to > > > > > > com.google.apphosting.utils.servlet.DeferredTaskServlet > > > > > > The documentation onDeferredTasks is a little bit sparse... Any > > > > > > pointers appreciated. > > > > > > > Basically what I would like to do is have multiple queue defined > > > > > > with > > > > > > different throttling settings. > > > > > > And use DeferredTask to send them to one of the queues depending on > > > > > > the my needs. > > > > > > > I would have no problem with configuring additional servlet mappings > > > > > > using com.google.apphosting.utils.servlet.DeferredTaskServlet > > > > > > > On Apr 22, 8:58 am, Marcel Overdijk <marceloverd...@gmail.com> > > > wrote: > > > > > > > > Is it possible to useDeferredTasks outside the default queue? > > > > > > > > I would like to setup multiple queues with different config > > > settings. > > > > > > > > For theDeferredTasks a specific handler is setup at /_ah/queue/ > > > > > > > __deferred__ so I wonder how that would work with multiple > > > queues.... > > > > -- > > > You received this message because you are subscribed to the Google Groups > > > "Google App Engine for Java" group. > > > To post to this group, send email to > > > google-appengine-java@googlegroups.com. > > > To unsubscribe from this group, send email to > > > google-appengine-java+unsubscr...@googlegroups.com. > > > For more options, visit this group at > > >http://groups.google.com/group/google-appengine-java?hl=en. > > > > -- > > > You received this message because you are subscribed to the Google Groups > > > "giannim" group. > > > To post to this group, send email to gian...@google.com. > > > To unsubscribe from this group, send email to > > > giannim+unsubscr...@google.com. > > > For more options, visit this group at > > >http://groups.google.com/a/google.com/group/giannim/?hl=en. > > > -- > > Gianni Mariani > > Google, Sydney -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.