This section explains how to generate artifacts representing different scenarios based on previously created templates using the Template Manager dashboard.
...
Before you try out this scenario, you should create a template by following the instructions should be created as described in Configuring a Template for Template Manager.
Info |
---|
This tutorial uses the |
Using the template
Follow the procedure below to use the previously created SensorDataAnalysis
template in different scenarios.
Start WSO2 CEP by issuing one of the following commands:
- For Linux:
sh wso2 server.sh
- For Windows:
wso2server.bat
Info Anchor Apply Template Updates Apply Template Updates Warning icon false This is available for CEP 4.2.0 only as a WUM update and is effective from 27th April 2017 (2017-04-27). For more information on updating WSO2 DAS, see Updating WSO2 Products.
If you are starting CEP for the first time after making an edit to the template, include the
DoverwriteTemplateManager
parameter in the start command as shown below.- For Linux:
sh wso2 server.sh -DoverwriteTemplateManager=true
- For Windows:
wso2server.bat -DoverwriteTemplateManager=true
The
DoverwriteTemplateManager
parameter applies the changes you have made to the template.- For Linux:
- Log in to the management console using the following URL.
https://<CEP_HOST>:<CEP_PORT/carbon/
- Click Main, and then click Template Manager under the Manage menu. The following dashboard home page appears with the available domains as shown below.
- Select the relevant domain to configure the defined template (in this example it is SensorDataAnalysis). This opens the Deployed Scenarios page.
- Click Create New Scenario to add a new scenario to the selected domain. This opens the Edit Scenario page.
Enter values in the Edit Scenario page as follows.
Field Value Notes Scenario Type SensorAnalytics
This is the template created by following the instructions in Configuring a Template for Template Manager. Scenario Name SensorAnalytics
Description Calculate maximum and average temperature values.
Enter values for the configurable parameters as shown below.
Configurable Parameters Value Time(Mins) 1
Sensor Type Name temperature
Click Add Scenario.
If stream mapping is disabled, aA pop-up message appears to inform you that the configuration is successfully saved. Close this message. The scenario you configured is displayed in the Deployed Scenarios page as follows.
You can edit or delete this scenario by clicking the relevant link under Actions.- If there are stream mappings defined in the template (i.e. stream mappings enabled), on click of Add Scenario, you will be directed to stream mapping interface where you can map your input stream/streams to the predefined stream.
- As per selected value for the Mapped From: Stream Name, Stream Attribute Mapping section will be loaded and you can map the selected event stream attributes to the predefined stream.
- Click Save Mapping. You view a pop-up message on successful addition of the configuration.
- Close the pop-up message. You view the new scenario in the list of deployed scenarios of the selected domain. You can edit or delete it using the corresponding options provided as shown below.
- Upon successful configuration, you will find the templated artifacts have been deployed in CEP and to verify you can check the event flow created via the management console.
- In order to access the dashboard with templated gadgets, in the Main tab, click Analytics Dashboard.
- Enter your username and password, and then click Login.
- Select view mode in analytics-temperature-dashboard from the Dashboards menu as shown below.
- In order to simulate data for the created scenario, you can use the event simulator functionality to send multiple events using file utilizing default event simulator file(event.csv) which comes with CEP.
- Upon successful simulation, data will be published to the deployed dashboard as shown below.
Info In this example, the scenario gets deployed at this stage because no stream mapping is configured in the default
SensorAnalytics
template used. If you have configured stream mapping for your template, you are redirected to the Stream Mapping page when you click Add Scenario. Select an appropriate predefined stream from the list for the Mapped From: Stream Name field. This expands the page to display the Attribute Mapping section as demonstrated below. Map attributes as required and click Save Mapping.Once this configuration is successfully completed, the artifacts included in the template are deployed in WSO2 CEP. You can view the event flow for the template artifacts by logging into the WSO2 CEP Management Console, and clicking Main ∫=> Flow where it is displayed as follows.
- In the WSO2 CEP Management Console, click Main and then click Analytics Dashboard to open the Analytics Dashboard. Log in with your credentials. The dashboard named
analytics-temperature-dashboard
that is included in the template used in this example is displayed as follows.Anchor Access Dashboard Access Dashboard
- To simulate data in order to view statistics in the
analytics-temperature-dashboard
dashboard, do the following. For more information, see Sending Multiple Events Using a File.- In the WSO2 CEP Management Console, click Tools and then click Event Simulator to open the Event Stream Simulator page.
Click Configure for the
events.csv
file to open the Event Mapping Configuration dialog box. Enter the following values in this dialog box.Parameter Value Select the target event stream org.wso2.event.temperature.stream:1.0.0
Field delimiter ,
Click Configure and then click OK to close the message that appears to confirm that the configuration is successful.
- Click Play to simulate the event flow.
- Once you simulate the events, access the Analytics Dashboard and mentioned in step 6, and then click View on the
analytics-temperature-dashboard
dashboard. Data published to the dashboard is displayed as shown below.