Yes, I do this with JDO.  Just add to you queue within the current
transaction, for instance;

PersistenceManager pm = PMF.get().getPersistenceManager();
try
{
        //
        // start transaction so we can atomically check the secondary key
        //
        pm.currentTransaction().begin();

        //
        // enqueue a task to process this ImportTask
        //
        //
        String theUrl = "/tasks"; // whatever your url will be - this is is
your state;
        Queue queue = QueueFactory.getDefaultQueue();
        queue.add(
        
DatastoreServiceFactory.getDatastoreService().getCurrentTransaction(),
                TaskOptions.Builder.url(theUrl));

        //
        // commit the transaction.
        //
        pm.currentTransaction().commit();       // we finished, so commit the
transaction.
}
catch(DataAccessException dae)
{
        throw dae;      // let prior DataAccessException leave.
}
catch(Exception e)
{
        throw new DataAccessException(e);       // wrap the exception in our
runtime exception.
}
finally
{
        //
        // if the transactions is still active, then there
        // was an exception thrown.  So we rollback the transaction.
        //
        if(pm.currentTransaction().isActive())
        {
                pm.currentTransaction().rollback();
        }

        //
        // we always close the PersistenceManager when done.
        //
        if(!pm.isClosed())
        {
                pm.close();
        }
}


On Jan 11, 10:45 am, Fabrizio Accatino <[email protected]> wrote:
> Hello,
>
> documentation tells I can insert a task in queue during a datastore
> transaction.http://code.google.com/appengine/docs/java/taskqueue/overview.html#Ta...
>
> The example uses datastore low level api. Is there a way to do the same with
> JDO?
>
> Thank you
>
>    Fabrizio

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