Photo by Guillermo Ferla on Unsplash
Intro to Orion Context Broker
Manage your data in an IoT deployment with this open source server
Orion Context Broker is an open source server for easily managing IoT information at a higher level of abstraction for your application.
What's what
So, what actually is the Orion Context Broker? Why should I care? What kind of problems can I solve by using it? What are other alternatives out there and how does it compare? Orion is a constellation named after a mythological giant. But that's not why you are here, are you?
According to the official documentation, this is what the software is about:
Orion Context Broker allows you to manage all the whole lifecycle of context information including updates, queries, registrations and subscriptions. Using the Orion Context Broker, you are able to register context elements and manage them through updates and queries. In addition, you can subscribe to context information so when some condition occurs (e.g. a context element has changed) you receive a notification.
A few key points:
It is a server. It is not a library, it is not a framework. It is a software you deploy somewhere and serves requests from other software. Just like an HTTP server serves web pages, Orion serves NGSI information.
Context Information. This is any data about a situation that your application cares about and wants to do something about. For example, if my app is about improving the experience of motorbike riders then my context information may be info related to the bike, such as speed, model, weight, current temperature, etc.
NGSI stands for Next Generation Service Interface, which is a way to say that it is a protocol that wants to be used in new services popping out in technology such as IoT. NGSI is a standard developed by the Open Mobile Alliance and supported by players like Telefonica, Orange, NEC among many others through FIWARE.
Manager. Orion's purpose is to manage or broker this information. It will make it available to your applications and you will be able to draw pretty graphics, pie charts, analyze the data, and many other cool things.
Example
Let's suppose we have a fleet of cars with a software component that is able to communicate with our Context Broker. Our drivers are a bit wreckless and we have decided to install an app in our phone that tracks the car speed at any given time.
Using the context broker, we can then ask about the speed of a certain car, or several cars, or by geographical area, or using regular expressions, or... you get the point. And all this we get without even caring of keeping track of each individual car, whose software is constantly updating the system with current context information.
We could also work in an asynchronous way.
Now what our app is doing is telling the context broker to notify us when there is a condition met. This could be that one of our drivers is speeding, or that she has gone too far down some road.
Although in the previous picture the application and the context consumer are different entities there's nothing preventing a context consumer itself to subscribe for data changes.
Show me the alternatives
I find this to be a good exercise to get a grasp of what the software is about when you stack it against its competitors.
This selection of alternatives is based on two rather subjective approaches. First, what I feel are packages that could solve similar problems; and second, those that people ask me the most about what the differences are between it and Orion. If you feel that I have missed out on something very obvious, feel free to point it out.
Also, I will try to expand on what I believe may be the differing factor that sets Orion apart.
Kafka, RabbitMQ and other message brokers
RabbitMQ is a messaging queue system that is highly performant.
For example, you could plug in a data short-term historical sink to Orion and draw upon it to get a view of the messages and its values and how they are changing in time.
Apache Kafka is a distributed messaging system intended to be used as a distributed commit log. It is durable and scalable by design. It depends on Zookeeper (another Apache project).
Both for Kafka and RabbitMQ there are a host of SDKs and many languages are supported.
I've seen Orion being used as a message router. Although it is not as fast as a RabbitMQ or Kafka installation could be, it provides the benefit of typed messages. By typed I mean that the messages' type is NGSI. This protocol provides interconnectivity to a realm of FIWARE and non-FIWARE NGSI compliant interfaces that simplify many tasks. It is a higher level of abstraction at the cost of performance. This really makes more sense if your application isn't processing 50K messages per second, which many IoT scenarios won't.
In terms of support Orion is a bit behind but it's growing. There are SDKs for Java, Javascript and PHP, and many other developer tools.
Amazon SQS
Amazon SQS is a high availabilty messaging cluster as a service. It presents the usual [dis]advantages of being in the cloud, but it doesn't really compare much differently to Orion.
Support in the form of SDKs is really good.
Redis
Redis is an popular in-memory data store -with the ability to persist to disk- mainly used as a cache or object storage system. It has an array of plugins that greatly extend its core functionality. For example, it can act as a message broker.
Orion has been used as a simple data storage with added capabilities. On great difference is that Orion will not cache things for you in-memory with one exception: subscriptions. So for the most part you don't get the advantage of the speed that in-memory data stores give you. In fact, Orion uses a [Mongo][mongodb] database for persistence with all its benefits and quirks.
Another difference is that Orion complies with NGSI. So where Redis you work with simple data structures (lists, strings, etc) in Orion you deal with entities and attributes.
Here Redis also benefits from being the de facto standard in the industry. Being supported in many programming languages makes it easier to get into.
Firebase
Firebase is a framework that allows you to easily synchronize clients in your application. It leverages WebSockets technology to keep open channels between clients/servers to allow for easy and performant communication.
UPDATE: Since Google is owner of Firebase things have changed quite a bit. It isn't really comparable to Orion anymore.
License
Orion Context Broker is open source using the AGPL license. This means that you have to publish any changes you make to the Orion code itself, but not your networked application that merely uses it as one of its components.
The advantages of being open source are many and well documented. If you want to see/download the code, contribute ideas, vote for features or file a bug you are encouraged to do so in their github home.