SlideShare a Scribd company logo
FIWARE Orion Flink Connector
Sonsoles López (slopez@dit.upm.es)
Andres Muñoz (jamunoz@dit.upm.es)
Joaquin Salvachua (jsalvachua@dit.upm.es)
Gabriel Huecas (ghuecas@dit.upm.es)
Universidad Politécnica de Madrid
@jsalvachua, @FIWARE
Flink
Apache Flink is a framework and distributed processing engine for stateful
computations over unbounded and bounded data streams. Flink has been
designed to run in all common cluster environments, perform computations at
in-memory speed and at any scale.
2
Previous Architecture
3
Current Architecture
4
fiware-cosmos-orion-flink-connector
https://github.com/ging/fiware-cosmos-orion-flink-connector
https://fiware-cosmos-flink.readthedocs.io
Two parts:
● OrionSource: Receive notifications from the Context Broker
● OrionSink: Write data into the Context Broker
5
Connection
6
ORION
Context Broker
Flink Cluster
Flink Job (JAR)
orion-flink-connector
HTTP POST (Notification)
HTTP POST/PUT/PATCH
OrionSource
OrionSink
OrionSource
Receives data from the Orion Context Broker from a given port.
The received data is a Stream of NgsiEvent objects
val eventStream = env.addSource(new OrionSource(9001))
7
OrionSink
Sends data back to the Orion Context Broker
Takes a stream of OrionSinkObjects as a source:
● content: Message content in String format. If it is a JSON, it needs to be
stringified
● url: URL to which the message should be sent
● contentType: Type of HTTP content of the message (JSON, Plain)
● method: HTTP method of the message (POST, PUT, PATCH)
OrionSink.addSink( processedDataStream )
8
Basic Example
final val URL_CB = "http://flinkexample_orion_1:1026/v2/entities/"
final val CONTENT_TYPE = ContentType.JSON
final val METHOD = HTTPMethod.POST
def main(args: Array[String]): Unit = {
val env = StreamExecutionEnvironment.getExecutionEnvironment
// Create Orion Source. Receive notifications on port 9001
val eventStream = env.addSource(new OrionSource(9001))
// Process event stream
val processedDataStream = eventStream
.flatMap(event => event.entities)
.map(entity => {
val temp = entity.attrs("temperature").value.asInstanceOf[Number].floatValue()
new Temp_Node(entity.id, temp)
})
.keyBy("id")
.timeWindow(Time.seconds(5), Time.seconds(2))
.min("temperature")
.map(tempNode => {
val url = URL_CB + tempNode.id + "/attrs"
OrionSinkObject(tempNode.toString, url, CONTENT_TYPE, METHOD)
})
// Add Orion Sink
OrionSink.addSink( processedDataStream )
// …
}
9
Examples
https://github.com/ging/fiware-cosmos-orion-flink-connector-examples
https://fiware-cosmos-flink-examples.readthedocs.io
● Example 1: Simulated Orion Source Notification
● Example 2: Complete Orion Scenario with docker-compose
● Example 3: Packaging the code and submitting it to the Flink Job Manager
● Example 4: More complex operations (Flink AggregateFunction)
● Example 5: Structured values for attributes (objects)
10
def main(args: Array[String]): Unit = {
val env = StreamExecutionEnvironment.getExecutionEnvironment
// Create Orion Source. Receive notifications on port 9001
val eventStream = env.addSource(new OrionSource(9001))
// Process event stream
val processedDataStream = eventStream
.flatMap(event => event.entities)
.map(entity => {
val temp = entity.attrs("temperature").value.asInstanceOf[Number].floatValue()
new Temp_Node( entity.id, temp)
})
.keyBy("id")
.timeWindow(Time.seconds(10))
.aggregate(new Average)
// print the results with a single thread, rather than in parallel
processedDataStream.print().setParallelism(1)
env.execute("Socket Window NgsiEvent")
}
Demo: Average temperature for each entity
13
Demo: Maximum temperature overall
def main(args: Array[String]): Unit = {
val env = StreamExecutionEnvironment.getExecutionEnvironment
// Create Orion Source. Receive notifications on port 9001
val eventStream = env.addSource(new OrionSource(9001))
// Process event stream
val processedDataStream = eventStream
.flatMap(event => event.entities)
.map(entity => {
val temp = entity.attrs("temperature").value.asInstanceOf[Number].floatValue()
println("Entity",entity.id, "Temperature", temp)
new Temp_Node( entity.id, temp)
})
.timeWindowAll(Time.seconds(10) )
.max("temperature")
// print the results with a single thread, rather than in parallel
processedDataStream.print().setParallelism(1)
env.execute("Socket Window NgsiEvent")
}
15
Thank you!
http://fiware.org
Follow @FIWARE on Twitter
17

More Related Content

What's hot (19)

PPTX
실시간 인벤트 처리
Byeongweon Moon
 
PPTX
Visualizing ORACLE performance data with R @ #C16LV
Maxym Kharchenko
 
PDF
Tutorial - 16 : How to pass parameters from one script to another by CallScri...
Yogindernath Gupta
 
PPTX
Apache Flink @ NYC Flink Meetup
Stephan Ewen
 
PDF
Textile
Vanessa Lošić
 
PPTX
Stabilising the jenga tower
Gordon Chung
 
PPTX
Zeromq - Pycon India 2013
Srinivasan R
 
ODP
Building serverless application on the Apache Openwhisk platform
Lucio Grenzi
 
PDF
Flink Forward SF 2017: Stephan Ewen - Experiences running Flink at Very Large...
Flink Forward
 
PPTX
MySQL Slow Query log Monitoring using Beats & ELK
YoungHeon (Roy) Kim
 
PDF
Anaysing your logs with docker and elk
melvin louwerse
 
PPTX
Ns2 ns3 training in mohali
Arwinder paul singh
 
PDF
R and cpp
Romain Francois
 
PDF
Triggers in MongoDB
Antonios Giannopoulos
 
PDF
A Fast and Efficient Time Series Storage Based on Apache Solr
QAware GmbH
 
PDF
Apache Flink Meetup: Sanjar Akhmedov - Joining Infinity – Windowless Stream ...
Ververica
 
PDF
SwiftyJSON 慘痛經驗
Hokila Jan
 
PDF
ECMAScript 2015 Tips & Traps
Adrian-Tudor Panescu
 
PDF
Reactive Programming with RxSwift
Scott Gardner
 
실시간 인벤트 처리
Byeongweon Moon
 
Visualizing ORACLE performance data with R @ #C16LV
Maxym Kharchenko
 
Tutorial - 16 : How to pass parameters from one script to another by CallScri...
Yogindernath Gupta
 
Apache Flink @ NYC Flink Meetup
Stephan Ewen
 
Stabilising the jenga tower
Gordon Chung
 
Zeromq - Pycon India 2013
Srinivasan R
 
Building serverless application on the Apache Openwhisk platform
Lucio Grenzi
 
Flink Forward SF 2017: Stephan Ewen - Experiences running Flink at Very Large...
Flink Forward
 
MySQL Slow Query log Monitoring using Beats & ELK
YoungHeon (Roy) Kim
 
Anaysing your logs with docker and elk
melvin louwerse
 
Ns2 ns3 training in mohali
Arwinder paul singh
 
R and cpp
Romain Francois
 
Triggers in MongoDB
Antonios Giannopoulos
 
A Fast and Efficient Time Series Storage Based on Apache Solr
QAware GmbH
 
Apache Flink Meetup: Sanjar Akhmedov - Joining Infinity – Windowless Stream ...
Ververica
 
SwiftyJSON 慘痛經驗
Hokila Jan
 
ECMAScript 2015 Tips & Traps
Adrian-Tudor Panescu
 
Reactive Programming with RxSwift
Scott Gardner
 

Similar to FIWARE Real-time Processing of Historic Context Information using Apache Flink. FIWARE Global Summit - Málaga 2018 - UPM Team (20)

PDF
FIWARE Global Summit - Real-time Processing of Historic Context Information u...
FIWARE
 
PDF
Timeplus: One single binary to tackle streaming and historical analytics
Zilliz
 
PDF
Hidden pearls for High-Performance-Persistence
Sven Ruppert
 
PDF
Big Data and Machine Learning with FIWARE
Fernando Lopez Aguilar
 
PDF
WRENCH: Workflow Management System Simulation Workbench
Rafael Ferreira da Silva
 
PDF
K. Tzoumas & S. Ewen – Flink Forward Keynote
Flink Forward
 
PPTX
Ondemand scaling-aws
Iegor Fadieiev
 
PDF
PhpTour Lyon 2014 - Transparent caching & context aware http cache
André Rømcke
 
PDF
Running a Scalable And Reliable Symfony2 Application in Cloud (Symfony Sweden...
Ville Mattila
 
PDF
JavaOne 2013 BOF2924 HoneySpiderNetwork
nvaneijck
 
PPTX
Developing your first application using FIWARE
FIWARE
 
PPTX
Building Your Own IoT Platform using FIWARE GEis
FIWARE
 
PPTX
Pharos
SeongHyun Jeong
 
PDF
Overview of Zookeeper, Helix and Kafka (Oakjug)
Chris Richardson
 
PPTX
adaptTo() 2014 - Integrating Open Source Search with CQ/AEM
therealgaston
 
PDF
Automating Security Response with Serverless
Michael Ducy
 
PDF
Microservices with Netflix OSS and Spring Cloud - Dev Day Orange
acogoluegnes
 
PPTX
Docker practical solutions
Kesav Kumar Kolla
 
PDF
David container security-with_falco
Lorenzo David
 
PDF
SOA in the cloud with FraSCAti, OW2con11, Nov 24-25, Paris
OW2
 
FIWARE Global Summit - Real-time Processing of Historic Context Information u...
FIWARE
 
Timeplus: One single binary to tackle streaming and historical analytics
Zilliz
 
Hidden pearls for High-Performance-Persistence
Sven Ruppert
 
Big Data and Machine Learning with FIWARE
Fernando Lopez Aguilar
 
WRENCH: Workflow Management System Simulation Workbench
Rafael Ferreira da Silva
 
K. Tzoumas & S. Ewen – Flink Forward Keynote
Flink Forward
 
Ondemand scaling-aws
Iegor Fadieiev
 
PhpTour Lyon 2014 - Transparent caching & context aware http cache
André Rømcke
 
Running a Scalable And Reliable Symfony2 Application in Cloud (Symfony Sweden...
Ville Mattila
 
JavaOne 2013 BOF2924 HoneySpiderNetwork
nvaneijck
 
Developing your first application using FIWARE
FIWARE
 
Building Your Own IoT Platform using FIWARE GEis
FIWARE
 
Overview of Zookeeper, Helix and Kafka (Oakjug)
Chris Richardson
 
adaptTo() 2014 - Integrating Open Source Search with CQ/AEM
therealgaston
 
Automating Security Response with Serverless
Michael Ducy
 
Microservices with Netflix OSS and Spring Cloud - Dev Day Orange
acogoluegnes
 
Docker practical solutions
Kesav Kumar Kolla
 
David container security-with_falco
Lorenzo David
 
SOA in the cloud with FraSCAti, OW2con11, Nov 24-25, Paris
OW2
 
Ad

Recently uploaded (20)

PDF
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
PDF
MiniTool Power Data Recovery 8.8 With Crack New Latest 2025
bashirkhan333g
 
PDF
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
PDF
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
PDF
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
PDF
AOMEI Partition Assistant Crack 10.8.2 + WinPE Free Downlaod New Version 2025
bashirkhan333g
 
PDF
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
PPTX
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
PPTX
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PPTX
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
PPTX
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
PDF
Adobe Premiere Pro Crack / Full Version / Free Download
hashhshs786
 
PPTX
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PDF
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
PDF
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
PDF
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
MiniTool Power Data Recovery 8.8 With Crack New Latest 2025
bashirkhan333g
 
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
AOMEI Partition Assistant Crack 10.8.2 + WinPE Free Downlaod New Version 2025
bashirkhan333g
 
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
Adobe Premiere Pro Crack / Full Version / Free Download
hashhshs786
 
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
Ad

FIWARE Real-time Processing of Historic Context Information using Apache Flink. FIWARE Global Summit - Málaga 2018 - UPM Team