0
votes

What I am trying to do is make a datastore put, and if it is successful, make a Search API put as well. This link has some useful info on how to do this with python, but I need an Objectify (Java) example.

I read that the way to do this is to have a transaction and then a task queue inside of that if it succeeds? Not sure how to do that so looking for a solid example.

1

1 Answers

1
votes

There is an overload for Queue.add() that accepts a transaction object. So, during your transaction, enqueue a deferred task that will sync to search, passing it ofy().getTransaction().

The task can be quite simple - the only state is a key object. You load the entity, make the search document, write it to the index.