You can use a deferred task which is an object launched on a queue like a regular task. Basically, it is a different Thread which is launched through the TaskQueue options and you can pass a serializable object instead of plain http parameters.
https://cloud.google.com/appengine/docs/java/taskqueue/overview-push#Java_Deferred_tasks
While the DeferredTask API is a convenient way to handle serialization
You need to create a class which extends DeferredTask (which has a constructor receiving your POJO).
public class MyDeferredTask implements DeferredTask {
private MyPojo pojo;
public MyDeferredTask(MyPojo pojo) {
this.pojo = pojo;
}
@Override
public void run() {
// TODO Do stuff with pojo
}
}
and then launch the task
MyDeferredTask task = new MyDeferredTask(pojo);
TaskOptions taskOptions = TaskOptions.Builder.withPayload(task);
TaskManager.getQueue("my-queue").add(taskOptions);
The good thing about this is that the if the payload is greater than 100kb, the POJO is automatically persisted on the datastore (up to 1 MB, as datastore entry limit) and then retrieved when your task starts.