You can pass an object to a task by first serializing it to a byte array, setting the byte array as the task payload, and then deserializing it when your task runs. The following code demonstrates how to do this:
http://code.google.com/p/gaevfs/source/browse/trunk/src/com/newatlanta/appengine/taskqueue/Deferred.java <http://code.google.com/p/gaevfs/source/browse/trunk/src/com/newatlanta/appengine/taskqueue/Deferred.java>You'll want to modify your code to do the following; note the use of the "serialize" method from the Deferred class: QueueFactory.getDefaultQueue().add(url("/url/to/servlet").payload(serialize(data))); Then within your task you can deserialize the object as follows Object obj = deserialize( req ); You might be able to use the Deferred class directly to solve your problem. Note that because of issue #2097, this serialization and deserialization of objects as the task payload does not work on the development server (but does work in production). You may want to star this issue: http://code.google.com/p/googleappengine/issues/detail?id=2097 Vince On Fri, Nov 13, 2009 at 2:52 PM, edarroyo <[email protected]> wrote: > Hello, > We are trying to set an object as a parameter for a task. > It seems the only values you can pass are strings, as we always get > Eclipse complaining that the funciont param() does not handle non- > string objects. > > What we are doing is the following: > > > QueueFactory.getDefaultQueue().add(url("/url/to/servlet").param > ("Key", data)); > > Where data is an object of type Test. > > How can we pass this object to our task and retrieve it? > > Thanks! > > -- > > -- 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=.
