0

A lot of work I want to do involves long-running processes that I want to run on a hosted environment and provide a web interface for users to see the results of the long-running jobs.

I believe Google App Engine with its "modules" feature (https://cloud.google.com/appengine/docs/java/modules/) is a great service for this but I have been struggling to figure out how to set it up for this purpose (see App Engine Modules with GWT, Possible to use Google Modules with Google Plugin for Eclipse?, How use Eclipse to develop Google Modules for Google Cloud?). Someone may have been trying to do the same thing (see: how to create gwt gae with app engine modules using google eclipse plugin) but there's no accepted answer and I'm looking for a more comprehensive set of instructions.

Could someone provide a step-by-step set of instructions to set up the following Hello World project involving the following project architecture?

Requirements

  • User visits web page and types in a job name, e.g. "Hello World" and their email address where they will receive the results.
  • Google App Engine then performs a long-running computation (e.g. 10 hours, i.e. much longer than the 10 minute time limit for a module of Scaling Type "Automatic" as described here https://cloud.google.com/appengine/docs/java/modules/).
  • Google App Engine then sends an email to the user stating that the "Hello World" computation is finished and provides the result in the body of the email message.

Project Architecture

  • Web front-end (ideally GWT but propose any suitable alternative since it may be a problem as described here: App Engine Modules with GWT)
  • Module 1 (Scaling Type = Automatic): Responds to web front-end requests by putting a job on a Google Task Queue with the name provided by the user. The email address is recorded in the Google Datastore with a primary key equal to the job name (the purpose is I want to see how to make two modules share the same datastore; it's alluded to here: Serving multiple GAE modules from one development server? but I'd like to see more detail).
  • Module 2 (Scaling Type = Basic Scaling): Picks up the job from the Google Task Queue, performs the long-running computation, and emails the result. Note the email address is obtained by looking it up in the datastore using the job name.

Development Environment

Community
  • 1
  • 1
Michael Osofsky
  • 11,429
  • 16
  • 68
  • 113
  • Jarrod, thanks for the link to http://stackoverflow.com/questions/1759387/google-app-engine-task-queue-on-gwt. The additional complexity I'm grappling with is how to incorporate Google Modules, which didn't exist in 2009 when the similar question was asked. – Michael Osofsky Oct 20 '14 at 18:00

1 Answers1

0
  1. Your first module is a GWT app. It provides a user interface.

  2. When a user initiates a request, you make a standard RPC call to one of your services within the same module. Within this service you crate a task using Task API. This task includes a target parameter which points to your second module.

Alternatively, you can make a REST call directly to your second module.

  1. Your second module is plain Java. It does not need GWT, and it's not a separate application in App Engine sense. It executes a task and emails the results to a user using App Engine Mail API.

You do not need anything special in Eclipse to create this setup. You simply create a new directory called EAR in your existing project and create/copy a bunch of configuration files. Modules Configuration provides detailed instructions on how to do it. If you are familiar with Backends, it may be easier to understand the process by reading Converting backends to Modules.

You can create two separate Eclipse projects - one per module, but it's not necessary. You can simply use a separate source directory for each module. For example, if you name your modules "gwtapp" and "backend" you can create the following packages in your project:

gwtapp.src.com.myproject...
backend.src.com.myproject...

Then open a build path (project Properties > Java Build Path), click on Source tab, then Add Folder. Add two folders:

gwtapp/src
backend/src

to your project. For each project select a different output folder: gwtapp/src will point to MyProject/ear/gwtapp/war/WEB-INF/classes, and backend/src will point to MyProject/ear/backend/war/WEB-INF/classes. You have to create these folders (ear/gwtapp/war/WEB-INF and ear/backend/war/WEB-INF respectively) before you do this step, of course.

Andrei Volgin
  • 40,755
  • 6
  • 49
  • 58
  • Andrei, thank you for the help. Can the Google Plugin for Eclipse be used to create the GWT app? And then do I add the EAR directory (etc.) to it? I'm afraid not because of http://stackoverflow.com/questions/23259113/how-to-create-gwt-gae-with-app-engine-modules-using-google-eclipse-plugin. Am I better off creating the initial project using Maven? – Michael Osofsky Oct 20 '14 at 18:08