sathish...

what you came across is a transactional way to add a task on a queue.

Toby described how I do it too (without transactions).

DatastoreServiceFactory.getDatastoreService().getCurrentTransaction()
is a low-level API way of retrieving the current datastore
transaction. If you add a task to a queue with the transaction, if the
transaction fails, the task will not be added on the queue. The task
will be added only if transaction commit succeeds.

Are you trying to add tasks transactionally or just add tasks? If you
don't care about transactions, do it like Toby showed.

By the way, you will not be redirected anywhere. queue.add(...) is
asynchronous and your servlet will exit. The url you're providing is
to your task servlet web hook that will get executed at a later time.

On Jun 13, 4:52 am, Toby <[email protected]> wrote:
> Hi Sathish,
>
> I am not actually sure about your problem. But I agree that the
> documentation is a bit complicated to decode.
> I do like that:
>
> TaskOptions     taskOptions = TaskOptions.Builder.url("/
> servlet").param("param", param).method(Method.GET);
>                         //enqueue request
>                         Queue queue = QueueFactory.getQueue("somequeue");
>                                   queue.add(taskOptions);
>
> In this example I do a GET request with one parameter. And I use a
> specific queue but you can also just get the default queue.
>
> On Jun 13, 9:14 am, sathish <[email protected]> wrote:
>
>
>
> > Hi i'm new to Task queue concept while reading about it i got struck
> > on this line
>
> >      queue.add(
>
> > DatastoreServiceFactory.getDatastoreService().getCurrentTransaction(),
> >       TaskOptions().url("/path/to/my/worker"));
>
> >    What will DatastoreServiceFactory do... How to redirect this page
> > to another servlet.... in the url i gave
> >  .url("/myservlet") but it doesnt redirected to servlet Please Help
> > me.
>
> > Regards,
> > Sathish

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to