Adding a Streaming Web Service Output Adapter to Streaming Lite
This tutorial will explain how to send output data from a Streaming Lite project into a Smart Data Streaming project, using the SWS Output Adapter and the Streaming Web Service (SWS).
We will be taking a pre-existing Streaming Lite project called “freezer_monitoring_lite”, and adding a SWS Output adapter to it. We will then show the flow of data from Streaming Lite into our pre-existing Smart Data Streaming project called “freezer_monitoring”.
The Streaming Lite project is deployed on a Raspberry Pi 2, and this tutorial is part of a larger series dedicated to showing the basic functionalities of Streaming Lite.
Make sure you have completed the following tutorials (in order) before continuing:
Additionally,
Streaming Lite runs a single instance of a streaming project. More specifically, it runs the .ccx file of a compiled Smart Data Streaming project on a remote device. Since we have already created the project “freezer_monitoring_lite”, we will need to edit it, recompile, and redeploy the new .ccx file onto our Raspberry Pi.
1. Open up the project “freezer_monitoring_lite” in HANA Studio.
2. Under “Output Adapters” in the palette, find the “SWS Output” adapter. We will be attaching this adapter to the “FilterEveryFifteenthRow” element.
3. Drag the adapter onto the diagram, and connect it to FilterEveryFifteenthRow
4. Click “Edit Properties”:
5. In the subsequent screen, under the Basic tab, configure the following fields:
a) Protocol: websocket
b) Destination Cluster Authentication Data: SYSTEM:<password>
c) SWS Server Host: <host>
d) SWS Server Port: 9093
e) Destination Workspace Name: default
f) Destination Project Name: freezer_monitoring
g) Destination Stream Name: MACHINEDATA
6. Go to the advanced tab, and set Use SSL to true. This value must match the value inside the SWS configuration file, which is mentioned in the “Streaming Web Service Configuration and Testing” tutorial. By default, the Streaming Web Service is configured to use SSL. Click ok to exit
Note: It would be good idea to go back into the SWS configuration file and make sure that the value <ssl-enabled> is in fact set to “true”.
7. Compile your project to generate the .ccx file. It will be located in the bin/ directory of your project folder.
8. Connect to your Raspberry with WinSCP, and move this .ccx file into the /home/pi/ directory. If your old project file is still there, overwrite it.
9. Using PuTTY, run the Streaming Lite project with the same command as before:
$HOME/install/bin/streamingproject --ccx $HOME/freezer_monitoring_lite.ccx --command-port 9230
10. Start the SWS using PuTTY. Connect to the SDS node in your HANA system as the <sid>adm Linux user, and navigate to the $STREAMING_HOME/bin directory. Start the SWS by running:
./streamingwebservice
We will now send values into our Streaming Lite project using the streamingconvert and streamingupload binaries, in order to see the output in our Smart Data Streaming (SDS) project.
11. In the SAP HANA Streaming Run-Test perspective in HANA Studio, start the “freezer_monitoring” project and navigate to the stream view for MACHINEDATA. This is where the output from the freezer_monitoring_lite project will appear after being pushed from Streaming Lite to SDS through the SWS Output adapter.
12. PuTTY to your Raspberry Pi, and run this command 15 times. Recall that this is done to simulate 15 rows of temperature values sent into Streaming Lite. After 15 rows, your Streaming Lite project will output one row containing the total temperature average.
echo "isFreezerTemperatureReading,i,RaspberryPi,90,2014-06-03T12:00:00.000,218" | $STREAMING_HOME/bin/streamingconvert -d "," -p SAPraspberrypi2-B3:9230/freezer_monitoring_lite | $STREAMING_HOME/bin/streamingupload -p SAPraspberrypi2-B3:9230/freezer_monitoring_lite
Alternatively, if you wish to input a large number of rows all at once, you may do so with a .csv file. For example, if we have a .csv file called “data.csv” containing 15 rows, we can input this data into streaming lite by running the following command:
cat data.csv | $STREAMING_HOME/bin/streamingconvert -d "," -p SAPraspberrypi2-B3:9230/freezer_monitoring_lite | $STREAMING_HOME/bin/streamingupload -p SAPraspberrypi2-B3:9230/freezer_monitoring_lite
13. You should now be able to see that row inside the stream view for MACHINEDATA, back in HANA Studio.
If you do not see the event data arriving in the MACHINEDATA input stream, then refer back to the detailed testing instructions in each of the pre-requisite tutorials for detailed instructions on testing each layer of the system.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
32 | |
13 | |
11 | |
10 | |
9 | |
9 | |
9 | |
9 | |
8 | |
8 |