I just committed an update to this to remove the static
DatastoreService instance.

Vince

On Sat, Oct 31, 2009 at 2:08 PM, Vince Bonfanti <vbonfa...@gmail.com> wrote:
> This looked like an interesting problem, and I already had most of the
> pieces in place, so here's my first attempt, which is implemented in a
> single class (also attached, along with some test files):
>
>    
> http://code.google.com/p/gaevfs/source/browse/trunk/src/com/newatlanta/appengine/taskqueue/Deferred.java
>
> I'm more than happy to contribute this for inclusion in the SDK.
>
> Some caveats:
>
>   1) Because of issue #2097
> (http://code.google.com/p/googleappengine/issues/detail?id=2097), this
> doesn't work on the development server (it does work in production).
> So go star that issue!
>
>   2) I've only done minimal testing on the production server (see the
> attached test files).
>
>   3) This post is the only documentation that's currently available.
>
> First, add the following your your web.xml:
>
>    <servlet>
>        <servlet-name>Deferred</servlet-name>
>        
> <servlet-class>com.newatlanta.appengine.taskqueue.Deferred</servlet-class>
>    </servlet>
>    <servlet-mapping>
>        <servlet-name>Deferred</servlet-name>
>        <url-pattern>/_ah/queue/deferred</url-pattern>
>    </servlet-mapping>
>
> Second, define the "deferred" queue within queue.xml (use whatever
> rate you want):
>
>    <queue>
>        <name>deferred</name>
>        <rate>10/s</rate>
>    </queue>
>
> Next, create a class that implements the
> com.newatlanta.appengine.taskqueue.Deferred.Deferrable interface; the
> "doTask()" method of this class is where you implement your task
> logic.
>
> Then, invoke the com.newatlanta.appengine.taskqueue.Deferred.defer()
> method to queue up your task:
>
>    TestDeferred testDeferred = new TestDeferred(); // implements Deferrable
>    Deferred.defer( testDeferred, "one", "two", "three", 1, 2, 3 );
>
> (Note that it would be possible to pass arguments as attributes to
> your Deferrable instance, rather than using varargs; I'm not sure it
> makes much difference which you choose).
>
> Just as for the Python implementation, if the arguments size exceeds
> 10KB, the arguments are stored in a datastore entity, which is then
> deleted when the task is executed. Also, your doTask() method can
> throw a PermanentTaskFailure exception to halt retries; any other
> exceptions cause the task to be retried.
>
> Let me know if you find this useful, have any questions or encounter
> any problems.
>
> Vince
>
> On Fri, Oct 30, 2009 at 6:13 PM, Jason (Google) <apija...@google.com> wrote:
>> Hi David. This may be coming to Java eventually, but it hasn't been started
>> yet. If you or anyone else is interested in contributing, let me know.
>>
>> - Jason
>>
>> On Wed, Oct 28, 2009 at 7:52 AM, David Chandler <turboman...@gmail.com>
>> wrote:
>>>
>>> Re: http://code.google.com/appengine/articles/deferred.html
>>>
>>> Will this be coming to AppEngine for Java?
>>>
>>> David Chandler
>>> http://turbomanage.wordpress.com
>>>
>>>
>>
>>
>> >>
>>
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to