Implementing Notifications on azure technologies
By Diogo Romão & Helder Santo
At Nmbrs, completing one project does not signal the end of our aim to improve our services for our customers. We believe that we have to continually find opportunities to improve the quality of our services.
Therefore, after we worked on building a background task framework, we decided to work on implementing notifications. We realised that every time our users were completing an action such as processing the salary of a specific company, they either had to wait for it to finish or continually check if the process was finished or not. Some reports can take several hours to generate, and if the user wanted to know if it had generated either they would have to stay on the same page, which meant they couldn’t do any other tasks in parallel, or they would have to come back to the page to check on its progress.
Now, as soon as they carry out an action, they are notified when the process is completed. This provides the user with a much better experience, provides them with clarity and efficiency, and for Nmbrs it saves the processing power that would go into users continually trying to check the status of their action.
Creating a notifications framework
We did this by creating a notifications framework using Azure SignalR Service and Event Grid Domain. Event Grid Domain is used to trigger a notification to a user, so when a task finishes we raise an event via the event grid. The SignalR Service simplifies the process of adding real-time web functionality to applications over HTTP. This allows us to push content updates to connected clients. Every time the user logs in, a connection to SignalR is established and an identifier is assigned to the user which is later used to send notifications to the user.
In addition, we used Redis, an in-memory data structure project implementing a distributed, in-memory key-value database. This is because unlike most web applications, Nmbrs is not a single-page application (SPA). This creates an additional challenge, which means that every time a user navigates to a different page they have to establish a new connection to SignalR, so we used Redis to maintain a record of the user and connection ID. When the user connects to SignalR, they send their user identifier and in return, SignalR gives them a connection ID. Now that transaction on SignalR is saved on Redis.
The notifications framework is connected to the background task framework. This means that everything that is executed through the background task framework can have access to this notifications framework because we know the status of the background task; whether it is executing and whether it is finished successfully or not. Therefore, once a background task is finished we can send a notification to the user through a number of channels: through the mobile app or the web app. We also wanted to make this a fully-connected experience, so even if an action was taken on the mobile app, users can be notified on the web app of this process’ completion.
When a user starts a run, they can register their intent to receive notifications, but it is up to them whether they want notifications or not.
The benefits
Much like consumers who receive notifications about emails rather than having to refresh their inbox, this new framework means users get notifications of their processes. It saves the user time, which they can use for other more valuable tasks, enabling them to be more productive. For Nmbrs, it has opened up several more possibilities for the product, as up until now we hadn’t had a reactive, event-driven application. This means internally, we can make changes as soon as specific tasks finish as we’re notified about this. In addition, developers are now able to add notifications into their modules with ease.
For now, the notifications are only used on a specific component, which is for payroll processing but we will expand this to other functionalities such as reports, pension exports and wage tax declarations — essentially everything that takes some time to process.
If you want to know more about us, follow us on LinkedIn, Twitter, Facebook and Instagram!