Chronicle of eventful life. Sevlets and servants. How To Make The All-in-One Platform For Connected Vehicles and People On The Move. Vol. 4.
We decided to regularly and step-by-step describe how BaseRide platform works. We want to share some technical details that will let you get the process in general and see the architecture. This part contains 5 important questions.
Life of BaseRide server is full of events. We made it on purpose - provided with an event status all types of data we work with.
What do we consider an event?
Something important happens each second. Happens to vehicles and people connected to our services. Someone gets into the zone, someone sends updated coordinates letting know “I’m here” or “I’ve moved there”. Or a shock sensor detects a hit and sends a sad notification searching for moral and technical support. For we have over 40 000 moving objects connected, our server has not time to get bored.
And of course, our server is to handle all this data in a proper way. Proper means effective and productive. We’ve done it.
As you remember, our server consists of 3 blocks and BaseRide platform was created by means of asynchronous programming. These 3 blocks are built in a whole system of event handling.
What does the process of handling look like?
No, we should put another question here.
What are servlets and servants?
They are parts of the 3rd block of BaseRide server.
Servlet is a server record and a process. And servant is a specialized process, focused on an exact task within this very servlet.
BaseRide has several types of servants. And they are rather monofunctional.
For example, there are servants for scanning arrival forecasts, but another servant sends these forecasts to LED monitors at bus stops.
So what does the process of handling events look like?
First of all events are sent to servants.
Some of them control sensors parameters.
The servant generates an event “Off the range”, if a sensor went beyond the given limits.
There is the servant looking after a vehicle - it should generate an event if a definite vehicle entered a definite geo-zone.
There is even the servant generating an event if a user gets to save something. We made it to enable notifications for other users who can be interested in it.
How are notifications generated?
All events are put through ZeroMQ system. And notifications are sent by JS libraries. By WebSockets or Sock JS to be exact.
And that’s why in case you want to know, for example, if any vehicle of the fleet has idling time or converges the route, - you can subscribe to this type of an event. We integrated our services with Slack, so you can get notified via it.