Hi Sajith,

You can achieve above with Analytics Event table. Please refer below
resources as reference.

https://github.com/wso2/analytics-apim/blob/master/
features/org.wso2.analytics.apim.feature/src/main/
resources/template-manager/executionplans/APIMAnalytics-
AbnormalAccessTokenRefresh.siddhiql

https://docs.wso2.com/display/DAS310/Understanding+Event+
Streams+and+Event+Tables#UnderstandingEventStreamsandEventTables-
AnalyticseventtableAnalyticseventtable

Thanks,
Mohan


On Wed, Aug 16, 2017 at 12:45 PM, Sajith Abeywardhana <sajith...@gmail.com>
wrote:

> Hi,
>
> How to read the data from the already stored stream(com.xxx.sensor.
> notification.configuration.stream) when the below siddhi query get
> executed. Query is getting executed when data is arriving to the 
> *com.xxx.sensor.event.data.stream
> *stream.
>
>
> /* Enter a unique ExecutionPlan */
> @Plan:name('light-sensor-notification-execution-plan')
>
> @Plan:trace('true')
>
> @Import('com.xxx.sensor.event.data.stream:1.0.0')
> define stream input_sensor_data_event_stream (BS_ID string, PIR int, SOUND
> int, LIGHT int, A_T double,
> EVENT_TIME long, FROM_TIME long, TO_TIME long, DAY_OF_WEEK string,
> TIME_AS_24_HOUR string);
>
> @Import('com.xxx.sensor.notification.configuration.stream:1.0.0')
> define stream notification_configuration_stream (sensorType string,
> deviceKey string, fromTime string, toTime string, datOfWeek string,
> detectionStatus string, slot int, reArmTime int);
>
> @Export('com.mitrai.notification.sending.stream:1.0.0')
> define stream output_sensor_data_events_stream (DEVICE_KEY string,
> SENSOR_TYPE string, SENSOR_VALUE int, DAY_OF_WEEK string,
> TIME_AS_24_HOUR string, FROM_TIME string, TO_TIME string, SLOT int,
> RE_ARM_TIME int, DETECTION_STATUS string);
>
>
> from input_sensor_data_event_stream#window.length(1) as evt unidirectional
> join notification_configuration_stream#window.time(50000 min) as conf
> on evt.BS_ID == conf.deviceKey
> select BS_ID as DEVICE_KEY, "light" as SENSOR_TYPE, LIGHT as SENSOR_VALUE,
> DAY_OF_WEEK as DAY_OF_WEEK,
> TIME_AS_24_HOUR as TIME_AS_24_HOUR, "0600" as FROM_TIME, "0830" as
> TO_TIME, 1 as SLOT,
> 20 as RE_ARM_TIME, "temp" as DETECTION_STATUS
> insert into output_sensor_data_events_stream;
>
> Thanks,
> Sajith.
>



-- 
*V. Mohanadarshan*
*Associate Tech Lead,*
*Data Technologies Team,*
*WSO2, Inc. http://wso2.com <http://wso2.com> *
*lean.enterprise.middleware.*

email: mo...@wso2.com
phone:(+94) 771117673
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to