How to add backend function that gets triggered according to changes in the datastore?

73 views
Skip to first unread message

jackson wang

unread,
Feb 26, 2016, 12:20:50 PM2/26/16
to Google App Engine

After days of frustration with AWS, I decided to try out Google App Engine. However, I'm not sure what I can do to have a backend function that gets triggered to run a full text search algorithm in the database. When new data is added to the database, I want this function to be invoked and do a search action in the database, then send notifications according to the search result.


What I want to do is like Parse Cloud Code, or AWS Lambda + S3. 


Please help, I'm desperate, any suggestions would be highly appreciated.

Joshua Johnston

unread,
Feb 26, 2016, 2:08:38 PM2/26/16
to Google App Engine
Which database are you referring to (datastore, cloudsql, etc)? What is responsible for adding data to the database (python ndb, java, datastore rest api)?

For example, if you were writing an application using the python sdk for google app engine, and ndb to access the datastore you could implement the pre put hook to add an item to a task queue or a flag in memcache that could be used to trigger your full text search.

Nick (Cloud Platform Support)

unread,
Feb 29, 2016, 1:42:00 PM2/29/16
to Google App Engine
Since you control what is in your code, you can control whether all entity put / update events also then trigger any code you want to run. From such a high level description, there are many possible implementations.

You could use any number of persistence layers for various languages which support  such as JPA, JDO (Java), NDB Model "Hook Methods" (python), or if using the Cloud Datastore REST API or an appengine language-runtime API directly, you can simply be sure to put the relevant function calls wherever you also have a post/put or update.

There are many services on the platform which might be of use to you in further exploring message passing patterns and logical flow relating to databases that you build:

Datastore Transactions



 
 

On Friday, February 26, 2016 at 12:20:50 PM UTC-5, jackson wang wrote:
Reply all
Reply to author
Forward
0 new messages