Data Transformation Getting Started Guide
What is Apache Edgent? Edgent is an open source programming model and runtime for edge devices that enables you to analyze streaming data on your edge devices.
When you analyze on the edge, you can:. Reduce the amount of data that you transmit to your analytics server. Reduce the amount of data that you store Edgent accellerates your development of applications to push data analytics and machine learning to edge devices. (Edge devices include things like routers, gateways, machines, equipment, sensors, appliances, or vehicles that are connected to a network.) Edgent applications process data locally—such as, in a car, on an Android phone, or on a Raspberry Pi—before it sends data over a network.
For example, if your device takes temperature readings from a sensor 1,000 times per second, it is more efficient to process the data locally and send only interesting or unexpected results over the network. See to help you quickly start to get a sense of Edgent's capabilities.
Want to learn more about your Honda? Honda accord v6 manual.
Releases of Edgent prior to 1.2.0 distributed Edgent and the samples differently than today. See if you are trying to use an older version. There's a lot of information available to get started with Edgent and no 'best order' for navigating it.
See the navigation sidebar on the left hand side of this page. In particular it is recommended that you review and visit the various items under Get Started. If you want to get a developent environment setup quickly see the item. The Edgent Cookbook topic includes many well documented recipies that are good for learning and jump-starting the development of your application.
The rest of this page is a detailed introduction to Edgent using a simple simulated Temperature Sensor application. Apache Edgent and streaming analytics The fundamental building block of an Edgent application is a stream: a continuous sequence of tuples (messages, events, sensor readings, and so on). The Edgent API provides the ability to process or analyze each tuple as it appears on a stream, resulting in a derived stream. Source streams are streams that originate data for analysis, such as readings from a device's temperature sensor. Streams are terminated using sink functions that can perform local device control or send information to external services such as centralized analytic systems through a message hub. Edgent's primary API is functional where streams are sourced, transformed, analyzed or sinked though functions, typically represented as Java8 lambda expressions, such as reading - reading 80 to filter temperature readings in Fahrenheit. A topology is a graph of streams and their processing transformations.
A provider is a factory for creating and executing topologies. Basic Edgent Applications follow a common structure:.
Get a provider. Create the topology and compose its processing graph. Submit the topology for execution More sophisticated applications may consist of multiple topologies that may be dynamically created and started and stopped using commands from external applications. Temperature Sensor Application If you're new to Edgent or to writing streaming applications, the best way to get started is to write a simple program. First we'll go over the details of the application, then we'll run it. Let's create a simple Temperature Sensor Application.
The application takes temperature readings from a sensor 1,000 times per second. Instead of reporting each reading, it is more efficient to process the data locally and send only interesting or unexpected results over the network. To simulate this, let's define a (simulated) TempSensor class.
Topology topology = dp. NewTopology ; In Edgent, Topology is a container that describes the structure of your processing graph:. Where the streams in the application come from. How the data in the stream is modified Our application then composes the topology's progessing graph. Creating a source TStream In the TempSensorApplication class above, we have exactly one data source: the TempSensor object. We define the source stream by calling, which takes both a function and a time parameter to indicate how frequently readings should be taken. In our case, we read from the sensor every millisecond.
TStream tempReadings = topology. Poll ( sensor, 1, TimeUnit. MILLISECONDS ); Calling topology.poll to define a source stream creates a TStream instance (because TempSensor.get returns a Double), which represents the series of readings taken from the temperature sensor. A streaming application can run indefinitely, so the might see an arbitrarily large number of readings pass through it. Because a TStream represents the flow of your data, it supports a number of operations which allow you to modify your data. Filtering a TStream In our example, we want to filter the stream of temperature readings, and remove any 'uninteresting' or expected readings—specifically readings which are above 50 degrees and below 80 degrees.
To do this, we call the TStream's method and pass in a function that returns true if the data is interesting and false if the data is uninteresting. TStream filteredReadings = tempReadings. Filter ( reading - reading 80 ); As you can see, the function that is passed to filter operates on each tuple individually. Unlike data streaming frameworks like, which operate on a collection of data in batch mode, Edgent achieves low latency processing by manipulating each piece of data as soon as it becomes available. Filtering a TStream produces another TStream that contains only the filtered tuples; in this case, the filteredReadings stream.
Printing to output When our application detects interesting data (data outside of the expected parameters), we want to print results. You can do this by calling the method, which prints using.toString on each tuple that passes through the stream. Print ; Unlike TStream.filter, TStream.print does not produce another TStream.
This is because TStream.print is a sink, which represents the terminus of a stream. A real application typically publishes results to an MQTT server, IoT Hub, Kafka cluster, file, JDBC connection, or other external system. Edgent comes easy to use connectors for these. See the connectors samples, and Edgent Cookbook for more information. You can define your own sink by invoking and passing in your own function. Submitting your topology Now that your topology / processing graph has been completely declared, the final step is to run it. DirectProvider contains a submit method, which runs a topology directly within the current virtual machine.
117725 630904 34155236. As you can see, all temperatures are outside the 50-80 degree range.
Data Transformation Getting Started Guide
In terms of a real-world application, this would prevent a device from sending superfluous data over a network, thereby reducing communication costs. Building and Running Its easiest to use the Edgent Samples Source release to get started.
If you just want to see this application in action, it's one of the provided samples! Go to to get and build the samples. Then you can run this application from the command line.
Cd cd topology;./run-sample.sh TempSensorApplication 630904. ^C to terminate it If you setup an Eclipse workspace with the samples, you can run the application from Eclipse:. From the Eclipse Navigate menu, select Open Type. enter type type name TempSensorApplication and click OK. right click on the TempSensorApplication class name and from the context menu.
click on Run As, then Java application. TempSensorApplication runs and prints to the Console view.
Getting Started Guide Pdf
Click on the terminate control in the Console view to stop the application. Creating your own project In this flow we'll take you though creating a new project for this application. Its easiest to use the template project in the Edgent Samples to get started. Go to and follow the steps to. do the general samples setup.
clone the template project to use for this application Then create the TempSensor.java and TempSensorApplication.java files in the project, copying in the above code. To build and run from the command line, see the new project's README.md (copied in from the template). In the project's folder (adjust the package name below if appropriate)./mvnw clean package./app-run.sh -main com.mycompany.app.TempSensorApplication 630904. ^C to terminate it If you setup the cloned template in an Eclipse workspace:. From the Eclipse Navigate menu, select Open Type. enter type type name TempSensorApplication and click OK. right click on the TempSensorApplication class name and from the context menu.
click on Run As, then Java application. TempSensorApplication runs and prints to the Console view. Click on the terminate control in the Console view to stop the application.
Getting Started Pdf
Next Steps This introduction demonstrates a small piece of Edgent's functionality. Edgent supports more complicated topologies, such as topologies that require merging and splitting data streams, or perform operations which aggregate the last N seconds of data (for example, calculating a moving average). Typically your application will want to publish to an IoT hub and be controlled by applications in a data center.
There are many more useful resources under the Get Started and Edgent Cookbook topics in the navigation sidebar on the left hand side of this page. Apache Edgent is an effort undergoing Incubation at The Apache Software Foundation (ASF), sponsored by the Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects.
While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
Comments are closed.