user1353777
user1353777

Reputation: 17

How can two AppEngine applications inter-communicate?

I try to build an application in Google App Engine, but i have some question and don't know how to solve it.

I try to build two application, one is get a String from user, and other is process the String like divide or encrypt.

My question is how to transmit the String between two application in Google App Engine? And can I build an application just process the String, don't present the WEB page.

Any one can give me some tips? thanks a lot.

Upvotes: 2

Views: 1324

Answers (2)

Fraser Harris
Fraser Harris

Reputation: 1942

One way to do this would be to have a shared database. App A would intake user data and save it to the database. App B would pull the user data and process it.

An Accepted feature request is for multiple App Engine applications to share datastore access [1].

Multiple App Engine applications can share access to Google Cloud SQL instances [2].

To grant access to your App Engine application:

From the Google Cloud SQL pane of the APIs Console, find the instance that you 
want to grant access to and click the on the name of your instance.
Click on the Instance settings button on the instance's dashboard.
On the Instance settings window that appears, enter your Google App Engine
application ID under the Authorized applications section. You can grant access to
multiple applications, by entering them one at a time.

Note: you can achieve this with one app using the datastore. Here are a couple of accepted patterns:

  1. A RequestHandler takes in user data, queues a task to process the data and save it.
  2. A RequestHandler takes in user data & saves it. A cron job pulls all recent models of that type, processes them, and saves the processed data.

[1] https://code.google.com/p/googleappengine/issues/detail?id=1300

[2] https://developers.google.com/cloud-sql/docs/before_you_begin#configure_access_control

Upvotes: 0

Adam Crossland
Adam Crossland

Reputation: 14213

The only way for two AppEngine applications to communicate with one another is through the normal HTTP request/response model. For your case, we'll have App A, which answers requests from a User, who provides a string to be processed. App B will receive requests from App A, which passes along the string to be processed.

  1. App A handles the URL /providestring?string=... where ... is some arbitrary value
  2. App B handles the URL /processstring?string=... where ... is some arbitrary value
  3. User uses a browse or writes an application that makes a call to /providestring
  4. App A's URL-handling code runs and extracts the value of the string parameter
  5. App A uses URLFetch to call App B's /processstring
  6. App B's URL-handling code runs and extracts the value of the string parameter and does whatever kind of processing it does and sends some sort of response to the caller.

Upvotes: 4

Related Questions