What is event-driven architecture?
Event-driven architecture (EDA) is at the centre of modern infrastructure. According to Wikipedia, event-driven architectures can be defined as “a software architecture paradigm promoting the production, detection, consumption of, and reaction to events. An event can be defined as “a significant change in state”. For example, when a consumer purchases a car, the car’s state changes from “for sale” to “sold”.
It is also a paradigm that many organisations are adopting at pace. Gartner predicted back in 2018 that by 2022:
- Event notifications will form part of over 60% of new digital business solutions
- Over 50% of business organisations will participate in event-driven digital business ecosystems
- 50% of organisations managing APIs will incorporate mediation of event notifications into their operations
While there are many factors behind this trend, there are a few major ones to take note of:
- Microservices adoption is growing
- Real-time/just in time decision making is a competitive advantage
- Decoupling has led to concerns about the reliability of synchronous communication between applications and services
Why does EDA matter for IoT?
One of the major opportunities that event-driven architecture provides is the ability to scale effective Internet of Things (IoT) strategies. On their own, an IoT device tend to deliver the follow types of information:
- State change or condition information
- Location-centric information
- Domain-specific information
An example of this is a device used to measure wind speed. The change in wind speed is our stage change, and where the wind speed device has been installed in a certain spot the wind speed data is specific to its location. The data received from the device is the specific information in the domain of wind speed.
Older IoT devices are typically REST-based, so you would poll them for a response. The event-driven way is a device asynchronously sending out state changes, or other kinds of information, back to the provider and/or consumer – think ‘fire and forget’.
Where IoT starts to get exciting is when we bring different IoT devices together, leveraging event-driven architectures, along with adding domain knowledge and past data.
A delivery vehicle can be used to illustrate the value of bringing these components together. With constant influxes of large real-time data sets, consumers and/or providers (depending on the IoT service/product) can start to:
Get an overview of the “bigger picture”
If you start to combine all of the devices collecting the data, such as telemetry devices on vehicles, traffic sensors by the road, domain knowledge on how to calculate speed and predict traffic, weather sensors to let us know what’s happening, along with data such as maps, we start to see what’s going on
Make predictions: You can now use the “bigger picture information” to deliver accurate predictions on estimated time of delivery based on current speed and predicted traffic congestion. Our weather sensors can let us know if rain is due, causing further changes to traffic behaviour. We can start to predict what a vehicle may do in a given location under certain conditions, and when it may arrive.
Just in time decisions
We can take our predictions further. Based on domain knowledge and historical data, we can start to build predictive models which are fed with our event data, and use this to react under those certain conditions. For example, we can start to suggest new routes to take to avoid the expected traffic
Create and monetise new data products
We can leverage these new data products that we’ve created, for example selling a satellite navigation system, offering information on more accurate delivery times as a premium product.
Consistency and compatibility
The reality is that there are several IoT challenges to overcome relating to event-driven architecture, such as:
Device management:
“How can I be sure that all my devices are where they’re supposed to be, doing what
they’re supposed to do. What versions of firmware are they on, and are they working properly?”
Security:
“How am I sure that those who have access to my device should have
access. How do I protect my devices from malicious and accidental attacks?”
Event management and compatibility:
“How can I manage the various protocols that my event-driven architecture
is built on? And how do I make different protocols compatible with each other to ensure a consistent, accurate flow of data?”
Scalability:
“How do I keep my IoT devices working ‘in peace’ as I scale the amount
of devices collecting information from 10? To 100? To 1000? And so on.”
API Management
API Management is a set of processes and tools that enable effective design, development, deployment and maintenance of APIs. In general, API Management offers solutions like:
- Security and access controls
- Protection of APIs
- Performance optimisation
- Documentation and governance
- Monitoring, logging, and alerting
All of the above are extremely useful when thinking about the challenges we looked at in relation to managing IoT devices.
We can take this further to look at more specific areas of opportunity API Management offers to EDAs involving IoT devices:
Separation of concerns:
- split out point to point connections in order to add, replace, update devices
Device polling:
- poll the device to make sure that the device is still working. This is also useful for REST-based devices to retrieve a current state to pass into the system
Device as API:
- wrap a device up as an API and serve it up to developers on your API
Management platform
Data transformation:
Change headers, response, etc. within the Gateway. This is especially useful when working with different protocols, or providing backward compatibility or hiding away changes from different service users.
Mix protocols and protocol mediation:
- A modern organisation will be looking at many different protocols in use, from REST, streaming protocols such as Apache Kafka and MQTT, and so forth. API Management can act as the translator between different APIs, enabling easier and wider use of available
- APIs, irrespective of what protocol they provide.
Wrapping up
One of the best ways to manage, secure, and therefore optimise an EDA-driven IoT strategy is through applying API Management to your IoT and Event landscape. To make this happen, we recommend organisations find a full-lifecycle API Management solution that can extend itself into areas of Event Management as well.
– Ljubica Lazarevic, Developer Relations at Gravitee –