1. The FI-WARE Project – Core Platform of the
Future Internet
Orion Context Broker Webminar
Fermín Galán (fermin@tid.es), Francisco Romero (frb@tid.es)
May 2013
http://www.fi-ware.eu
2. The FI-WARE Project – Core Platform of the
Future Internet
IndexIndexIndexIndex
Introduction
Basic concepts
NGSI API
Orion Broker in the FI-WARE Architecture
Demo
01
02
03
04
05
4. The FI-WARE Project – Core Platform of the
Future Internet
Introduction
Orion Context Broker is an implementation of a context information
broker with persistent storage that can play the role of two Generic
Enablers (GE) within the FI-WARE platform
• Pub/Sub Context Broker GE
• Configuration Management GE
It implements OMA NGSI9/10 specification
• NGSI9 is about context information availability (i.e. sources of context
information) management
• NGSI10 is about context information itself
Orion Context Broker running as Pub/Sub Broker GE
• It implements both NGSI9 and NGSI10
Orion Context Broker running as Configuration Management GE
• It implements only NGSI9
• It implements registration forwarding
3
6. The FI-WARE Project – Core Platform of the
Future Internet
Context
OMA NGSI Context Management is about management of Context data (aka Context
Information)
Context Information is always relevant to “entities”, although entities can be anything
(applications, users, things, …)
Orion Context Broker intermediates between context producers and context
consumers
5
Context
Broker
Applications
7. The FI-WARE Project – Core Platform of the
Future Internet
Context Elements (1/2)
Context Information in OMA NGSI is represented through data structures
called context elements which have associated:
• An EntityId and EntityType, uniquely identifying the entity to which context data refers.
• A sequence of one or more data element attributes (<name, type, value> triplets)
• Optional meta-data linked to attributes (also <name, type, value> triplets)
As an example, we may consider the context element reporting info on:
• attributes “speed”, “geolocation”, “current established route” of a “car”, or
• attributes “last message geolocation”, “last message contents” of an “user”
The EntityId is a string, and can be used to designate “anything”, not
necessarely “things” in the “real world” but also application entities
6
Meta-data
• Name
• Type
• Value
Context Element attributes
• Name
• Type
• Value
Context Element
• EntityId
• EntityType
1 n 1 n
“has” “has”
8. The FI-WARE Project – Core Platform of the
Future Internet
Context Elements (2/2)
There may be as many kinds of Context Elements as combinations of
attributes linked to an entity:
• Typically a context element is generated whenever an query (update) on values of
a list of attributes linked to an entity is requested (occurs)
• Only queried/updated attributes are communicated, so the amount of information
that is transmitted is minimized
Example:
• Cars may have attributes “brand”, “model”, “license plate”, “established route”, “geo-
location”, “current speed”, “gas level”
• The first time existence of the car is recorded, a context element bringing values of
attributes “brand”, “model”, “license plate” is generated
• Any time a route is established using the cars’ navigator, a context element bringing
updated values of “established route”, “gas level” and “geo-location” is generated
whenever a route is established
• A context element bringing updated values of “geo-location”, “current speed” and
“gas level” is generated every x minutes
Occurrences of context elements are referred as “events” in FI-WARE
7
9. The FI-WARE Project – Core Platform of the
Future Internet
Conceptual model: advantages
Not linked to a particular data/context representation formalism:
• Neither for transferring
• Nor storing
Can work with a standard IoT formats (SensorML) but at the same
time allows to overcome the limitations derived from the adoption of a
single standard format
The flexible nature of data structures linked to context elements
enable an optimized communication (only information about queried or
updated attributes is transferred)
8
11. The FI-WARE Project – Core Platform of the
Future Internet
OMA NGSI and FI-WARE APIs
NGSI Context Management specs have been published by OMA but
FI-WARE will not stick to what has been published:
• Ready to change whatever makes the API more usable and useful
• Ready to incorporate extensions to make the API more powerful yet simple
(convenience operations)
• Ready to fast-track incorporated changes in OMA
That’s why we distinguish between “OMA NGSI” and “FI-WARE NGSI”
We may consider potential extensions dealing with stream-based
communication in the future, for example
10
12. The FI-WARE Project – Core Platform of the
Future Internet
Basic entities and operations (1)
Context Producers publish data/context elements by invoking the
updateContext operation on a Context (Publish/Subscribe) Broker.
Context data is kept persistent by Context Brokers and ready to be queried while
not exceeding a given expiration time. This is a distinguishing feature of the OMA
Context Management model as compared to some Event Brokering standards.
You can think in the Context Broker as a kind of virtual Repository/DB where
producers insert context information and consumers query for it
Context Consumers can retrieve data/context elements by invoking the
queryContext operation on a Context Broker
11
Context Consumer
queryContext
Context Producer Context (Publish/Subscribe)
Broker
updateContext
13. The FI-WARE Project – Core Platform of the
Future Internet
Basic entities and operations (2)
Some Context Producers may also export a queryContext operation Context
Brokers may invoke at any given time to query on values of a designated set of
attributes linked to a given set of entities. They are called Context Providers.
Because Context Providers exporting the queryContext operation are
typically unknown “a priori”, Context Brokers export a registerContext
operation which enable to register what Context Producers may be queried
Note that the Application which subscribes a particular Context Producer may
or may not be the/a Context Producer itself
12
Application
registerContext (producer URI,
registration data, duration, registration_id)
Context Provider Context (Publish/Subscribe) Broker
queryContext
Context Consumer
queryContext
14. The FI-WARE Project – Core Platform of the
Future Internet
Basic entities and operations (3)
Some Context Consumers can be subscribed to reception of data/context
elements which comply with certain conditions, using the subscribeContext
operation a ContextBroker exports. Such subscriptions may have a duration.
Subscribed consumers spontaneously receive data/context elements compliant
with that subscription through the notifyContext operation they export
Note that the Application which subscribes a particular Context Consumer may
or may not be the/a Context Consumer itself
13
Application
subscription_id = subscribeContext (consumer, expr, duration)
Context ConsumerContext (Publish/Subscribe) Broker
notifyContext (subscription_id, data/context)
15. The FI-WARE Project – Core Platform of the
Future Internet
About queries, registrations and subscriptions
Queries, registrations and subscriptions requests are formulated on:
• List of entity ids (these ids may include patters)
• List of attributes or “attribute domains” (identifiers used to denote a group of related
attributes)
Besides, queries and subscriptions requests can be formulated so that certain
restrictions, established as conditions upon values of given attributes or
metadata, have to be met.
14
16. The FI-WARE Project – Core Platform of the
Future Internet
Context Broker Federation (1)
A Context Broker may be subscribed as Context Consumer on another
Context Broker
15
Application
sub_id_1 = subscribeContext (consumer1, expr1, duration1)
Context Consumer 1Context
Broker 2
notifyContext
Context Producer
Context Consumer 2
query
notifyContext
Application
sub_id_2 = subscribeContext (Context Broker GE 2, expr2, duration2)
Context
Broker 1
updateContext
queryContext
17. The FI-WARE Project – Core Platform of the
Future Internet
Context Broker Federation (2)
A Context Broker may be subscribed as Context Producer on another Context
Broker
16
Application
sub_id_1 = subscribeContext (consumer1, expr1, duration1)
Context
Broker 2
notifyContext
Context Producer
query
queryContext
Application
registerContext (Context Broker GE 2, what, duration2)
Context
Broker 1
updateContext
queryContext
Context Consumer 2
Context Consumer 1
18. The FI-WARE Project – Core Platform of the
Future Internet
Handling multiple subscriptions
A single Context Broker GE may handle several subscriptions
A Context Consumer may be subscribed through more than one subscription
A Context Consumer may consume events through subscriptions or making
explicit queries
17
Context Broker GE
Context
Producers
Context
Consumers
Producers port
subscription ports
subscriptions
update
query
notify
notify
update
query
19. The FI-WARE Project – Core Platform of the
Future Internet
Extended operations (1)
Context Brokers export the discoverContext operation enabling applications to
discover entities or even attributes and attribute domains that have been
registered in the system
18
Application 2
discoverContext
Application 1 Context (Publish/Subscribe)
Broker
registerContext
20. The FI-WARE Project – Core Platform of the
Future Internet
Extended operations (2)
Some applications can be subscribed to registration of entities or availability of
attributes and attribute domains which comply with certain conditions, using the
subscribeContextAvailability operation a ContextBroker may export. Such
subscriptions may have a duration.
Subscribed applications spontaneously receive updates on new entities,
attributes or attribute domains compliant with that subscription through the
notifyContextAvailability operation they export
Note that the subscriber and subscribed applications may not be the same
19
application1
subscription_id = subscribeContextAvailability (application2, expr, duration)
application2Context Broker
notifyContextAvailability (subscription_id, updates)
21. The FI-WARE Project – Core Platform of the
Future Internet
Some hints about OMA NGSI specs
Operations are grouped into two major interfaces (not clear why ☺
• NGSI-10
› updateContext
› queryContext
› subscribeContext / unsubscribeContext / updateContextSubscription
› notifyContext
• NGSI-9
› registerContext
› discoverContextAvailability
› subscribeContextAvailability / unsubscribeContextAvailability /
updateContextAvailabilitySubscription
› notifyContextAvailability
20
22. The FI-WARE Project – Core Platform of the
Future Internet
04
Orion Broker in the FI-WARE
Architecture
23. The FI-WARE Project – Core Platform of the
Future Internet
FI-WARE NGSI for IoT
NGSI IoT
Adapter
Native NGSI
IoT Agent
Native NGSI
IoT Agent
Backend
Applications
FI-WARE NGSI-9/10
(entities: sensors)
(entities: things, sensors, other)
FI-WARE NGSI-9/10
Pub/Sub Broker GE
Backend
Device Management GE
IoT Broker ConfMan
24. The FI-WARE Project – Core Platform of the
Future Internet
FI-WARE Context/Data Management Platform
23
Context/Data Management Platform
Applications
FI-WARE NGSI-9/10
Processing/Analysis
Algorithms
Gathered data
is injected for
processing/ana
lysis
Distributed
Context Sources
Complex Event Processing -
CEP
(IBM’s PROTON)
BigData Analysis/Processing
(COSMOS)
Pub/Sub Context Broker
(Gathering / Publication)
Processed data is
injected for
processing/analysis
Data generated either
by CEP or BigData is
published
Gathered data
injected for CEP-like
processing
25. The FI-WARE Project – Core Platform of the
Future Internet
Context-based application (FI-WARE Live Demo App)
24
Pub/Sub Context
Broker
Wirecloud
(App Front End)
CEP
Location
NGSI IoT
Adapter
Device Management GE
Nodes, AMMS, Regulators,
Issues, Vans, Technitians
… SmartSantander
App Backend
26. The FI-WARE Project – Core Platform of the
Future Internet
Context Broker versions
Two versions
• R1:
› The one currently available
› Uses MySQL as persistence layer
› Mono-thread
› Uses a different name (“SAMSON Broker”)
• R2:
› Available by end of June
› Uses MongoDB as persistence layer
› Multi-thread
25
28. The FI-WARE Project – Core Platform of the
Future Internet
Demo environment
27
Port Listener
NGSI
queries
responses
data
10.95.26.5510.95.249.25
tcp/44444
tcp/1026
tcp/27017
Client
29. The FI-WARE Project – Core Platform of the
Future Internet
Additional Orion Context Broker Resources
Download from (PPP member only by the moment)
• https://forge.fi-ware.eu/frs/?group_id=23
Page in the FI-WARE catalog
• http://catalogue.fi-ware.eu/enablers/publishsubscribe-context-broker-samson-broker
FIWARE NGSI
• NGSI9: http://forge.fi-ware.eu/plugins/mediawiki/wiki/fiware/index.php/FI-WARE_NGSI-
9_Open_RESTful_API_Specification_%28PRELIMINARY%29
• NGSI10: http://forge.fi-ware.eu/plugins/mediawiki/wiki/fiware/index.php/FI-WARE_NGSI-
10_Open_RESTful_API_Specification_%28PRELIMINARY%29
Manuals
• Installation and Administration Guide: http://forge.fi-
ware.eu/plugins/mediawiki/wiki/fiware/index.php/Publish/Subscribe_GE_-_SAMSON_Broker_-
_Installation_and_Administration_Guide
• Users and Programmers Guide: http://forge.fi-
ware.eu/plugins/mediawiki/wiki/fiware/index.php/Publish/Subscribe_GE_-_SAMSON_Broker_-
_User_and_Programmer_Guide
28