Database Reference
In-Depth Information
}
}
The application performs two types of requests, a registration request and
a log request. The registration request is initiated by the settings UI
component ( ManageActivity.java ), and you can see in Listing 8.1 that
the monitoring service initiates the logging request in transmit(…) . Both
classes use the CommandRunner class, shown in Listing 8.3 , that
implements the protocol described. This class is initialized with a host that
it will direct the requests to and provides a method that accepts a command
and JSON object pair and returns a JSON object result. It handles all the
details of turning this into a suitable request and decoding a suitable
response. Note how it also unifies all error handling across the three types
of errors discussed previously so that the caller needs to deal only with a
single uniform type of exception. This class provides a good transition to the
server side of the application because the two pieces integrate based on this
protocol, so the next section covers the server side implementation of this
protocol.
Log Collection Service
The Google App Engine was chosen for the implementation of the web
component of the service. This platform is particularly well suited to
building custom user interfaces over data hosted in BigQuery.
Communication between the services is simple and efficient; and the GAE
framework provides a number of support services, like scheduled tasks and
task queues, to build data management solutions on top of BigQuery.
Chapter 11, “Managing Data Stored in BigQuery,” and Chapter 12, “External
Data Processing,” discuss how to move data, in both directions, between
Datastore, the App Engine scalable transactional store, and BigQuery. In the
sample application, App Engine is used to manage the registry of devices,
relay logs from the devices into BigQuery, and serve the dashboard pages.
The source code for the application is available in the chapter download at:
ch08/sensors/cloud
To work with this code you need the App Engine Python SDK, which is
available
at
https://developers.google.com/appengine/
downloads .
Search WWH ::




Custom Search