- Log in to the Azure portal at https://portal.azure.com➢ navigate to the Azure Stream Analytics job you created in Exercise 3.17➢ select the Inputs link on the navigation menu ➢ select the Event Hub input (for example, brainwaves) ➢ and then click the Test button to confirm the connection is active.
- Select the Query link and confirm the query is the one from Exercise 7.2.
- Navigate to the Azure Synapse Analytics workspace you created in Exercise 3.3➢ start the SQL pool ➢ and then create the BrainwaveMedians table using the following SQL:
CREATE TABLE [brainwaves].[BrainwaveMedians] - Select the Outputs link from the navigation menu of your Azure Stream Analytics job ➢ click the + Add drop‐down ➢ select Azure Synapse Analytics ➢ enter a name (I used synapse) ➢ select the Select SQL Database from Your Subscription radio button ➢ select the subscription where your Azure Synapse Analytics SQL pool and table created in step 3 exist from the Subscription drop‐down ➢ select the SQL pool ➢ select Connection String from the Authentication Mode drop‐down ➢ enter the user ID (I used sqladminuser) of the SQL pool database ➢ enter the SQL pool database password ➢ and then enter brainwaves.BrainwaveMedians in the Table text box. Figure 7.12 shows the configuration.
FIGURE 7.12 Develop a stream processing solution Azure Stream Analytics output type Azure Synapse Analytics.
- Click the Save button (the connection must be successful) ➢ click the Query link on the navigation pane ➢ and then add the following query (located in the StreamAnalyticsQuery.txt file on GitHub) to the end of the existing query:
SELECT medianAPLHA, medianBETA_H, medianBETA_L, medianGAMMA, medianTHETA, - Click the Save Query button ➢ click the Overview link ➢ click the Start button ➢ download brainjammer.zip from the Chapter07/Ch07Ex03 directory on GitHub ➢ extract the files ➢ view the brainjammer.exe source code in the Program.cs and Session.cs files, also in the Chapter07/Ch07Ex03 directory ➢ run the brainjammer.exe application ➢ and then enter the required information, similar to that shown in Figure 7.13.
FIGURE 7.13 Develop a stream processing solution Azure Stream Analytics simulate streamed brain waves.
- After the stream of brain waves finishes, look through the output of the stream in ADLS and Azure Synapse Analytics ➢ pause the SQL pool ➢ and then stop the Azure Stream Analytics job.
The data sent to your ADLS container will be the same as what you saw previously in Figure 7.9. The only difference is that the year, month, and hour will be different. Execute the following query on your Azure Synapse Analytics SQL pool:
SELECT TOP (100) [BRAINWAVE_ID], [medianAPLHA], [medianBETA_H],
[medianBETA_L], [medianGAMMA],[medianTHETA], [Scenario]
FROM [brainwaves].[BrainwaveMedians]
The query results will be similar to that shown in Figure 7.14. The most interesting value is the one stored in the Scenario column.
FIGURE 7.14 Develop a stream processing solution Azure Stream Analytics sent to Azure Synapse Analytics.