Download as a PDF
Transcript
4.7. Storage Connector Module
45
6. After the previous step we have data streams for all devices but for convenience we have
a single data stream that includes the messages from all device data streams that were
created on the different Wisspr instances. We do this by creating a merging data stream
(see below).
7. In the end the URL to the data stream resource of the merging data stream and to the
queue of the merging data stream are returned to the user. For the user it is totally
transparent that multiple data streams were created on multiple Wisspr instances.
Merging Data Stream
The process of creating a merging data stream is relatively simple (D in figure 4.8):
1. The only argument that must be provided to create a merging data stream is a list of
data stream resource URLs.
2. First, all data stream resources are fetched (they contain the descriptions of each data
stream that participates in the merging data stream).
3. Afterwards, it is checked whether all the data streams use the same data fields. This is
necessary because merging data streams need to comply to our data stream semantics
too (see section 3.3) which implies that one common schema is necessary.
4. The next steps are similar to steps 4 to 6 for creating a device data stream.
Query Result Data Stream
The last type of data stream is a query result data stream (see section 3.6, E in figure 4.8).
The only parameter that needs to be given is the URL to the resource describing the query.
Information like for example the schema of the data stream are constructed from the messages
of the data stream when they arrive (see section 4.7). The next steps to create a query result
data stream are again similar to steps 4 to 6 for creating a device data stream.
4.7
Storage Connector Module
In many cases, client applications want to store sensor data permanently. With the storage
connector module this can be done easily (i.e. with just one POST request, see below). The
module persists data streams to common storage engines (e.g. databases).
The storage engines are external to the module and can be configured with an XML configuration file (a sample configuration file is shown in listing 4.7. When persisting a data stream
the user can indicate which storage engine to use (if she doesn’t specify one, a default will be
used).
4.7.1
Creating a Data Stream Persistence
To create a persistence for a data stream, the user sends a POST request to the Wisspr
instance (URL would be http://{wissprInstanceURL}/persistences) on which he wants to
persist a data stream (the data stream does not have to be registered on the same Wisspr
instance). The only mandatory parameter is the URL to the data stream resource. The user
can optionally specify the name of a configured storage engine to be used (a list of configured
storage engines is available from Wisspr ’s Web interface).