RESTful, Real-Time, Streaming Analytics and IoT
In this article, Jordan Thomas-Green walks us through various industrial IoT use-cases complete with applicable code samples, and introduces Cisco's Connected Streaming Analytics, a platform specifically designed for monitoring high volumes of data gathered by IoT sensors and devices.
Join the DZone community and get the full member experience.Join For Free
As any developer can attest to, the need for applications that are real-time, analytics-driven, and IoT-enabled is one that is ever-growing. Developing a solution that unlocks the value that customers crave requires the availability of high-velocity data streams that can be analyzed in real-time and easily integrated into multiple environments. Connected Streaming Analytics (CSA) is a new offering from Cisco that addresses this specific need, allowing developers to ingest real-time, streaming data through RESTful APIs and integrate them directly into their applications. This RESTful architecture gives developers access to portable and scalable streams of real-time data in addition to a wide-range of calls that provide access to historical data, govern usage, and provision queries.
Query Your Data in Real-Time
Perhaps the most notable feature of CSA is that it allows developers to query their streaming data in real-time using standard SQL functions—this is groundbreaking. A simple example would be developing an application that monitors flow rates at a water processing facility through IoT-enabled sensors. We can write a simple REST call such as seen below to expose our application to this data in real-time:
GET http://SERVER/stream/query/sql=SELECT AVG(flow_rate), sensor_name FROM iot_system.water_processing_facility GROUP BY sensor_name<slices '10 seconds'>
This snippet opens a JSON stream with the real-time flow rate streaming from each sensor averaged in 10 second intervals.
Traditionally, such real-time querying would not be available due to ETL delays and the lack of support of standard SQL functions in streaming APIs—this is where CSA shines.
Enable Real-Time IoT Applications
Scaling our aformentioned use case, imagine that we are developing an enterprise IoT application to monitor facility health at a network manufacturing plants around the globe. Central, regional, and field personnel can all have real-time access to their streaming machine data and make proactive decisions to mitigate risks and reduce downtime.
Vibration/acoustical analysis of industrial components is a common method of analysis used to predict machine wear. Using the code snippet below:
GET http://SERVER/stream/query/sql=SELECT component, location, region, dollar_value, vibration_value from WHERE vibration_value > threshold_value AND mission_critical_flag = 1 ORDER BY dollar_value DESC
A developer can query all components with a vibration reading above the manufacturer's specified threshold and sort them by asset value. The implications of this are huge—Through one API call, applications throughout the entire organization are given a continuous view of where there is potential for asset loss allowing the business to decide where to direct maintenance and how to mitigate risks.
Similarly, using the code snippet below:
GET http://SERVER/stream/query/sql=SELECT COUNT(components), location, region, SUM(dollar_value) from WHERE vibration_value > threshold_value AND mission_critical_flag = 1 GROUP BY location, region ORDER BY COUNT(components) DESC
A regional analyst can see in real-time, areas that are under high strain and disperse manpower accordingly. Simultaneously, a central analyst can divert operations and scheduling in a high-strain region to reduce the risk of failure until the components are properly maintained, a partially offshore production to facilities/regions with healthier production lines, and proactively reroute logistics accordingly.
Through the use of the CSA API, we have not only enabled an IoT application that is predictive, proactive, and real-time, but created a huge opportunity for a highly-automated and actionable system where traditionally data is delayed and siloed. These are the applications users crave! We've developed a demo with Japanese machine manufacturer MAZAK to give a glimpse of just how powerful this can be
Here you can demo a real-time dashboard powered by connected streaming analytics that monitors pH levels, temperature, and vibration in remote machines in real-time. To see how CSA is helping developers build value within their apps check out the Mazak Analytics demo of an IoT-enabled app.
Learn More About CSA
To learn more about CSA check out https://developer.cisco.com/site/csa/.
Opinions expressed by DZone contributors are their own.