June 26, 2019
The goals in my proposal for first evaluation were as follows:
The basic idea was to generate notifications from the events that a user is associated with and notify the user about that event. A simple example can be when a user creates a project, we can notify him that his project was successfully added to Librecores. I had decided beforehand that there would be two types of notifications: App/Web notifications that appear on the user navbar and Email notifications that are sent directly to the email-id associated with the user. So, on the users perspective, his actions would generate these notifications.
For web notifications, we used a Symfony bundle named mgilet/notification-bundle which you can find on GitHub.
While sending out these notifications, there can be a timelag in the UI due to processing of these notifications in the backend, which is of course not advisable.
RabbitMQ to the rescue.
In our case a publisher sent a notification to the queue as a serialized message and a Php class(Consumer) fetches this message and based on the type of the notification(email or app), sends it to the respective sink. The rough architecture that we follow is shown below:
So, currently we have two consumers. One is the web-notification consumer responsible for sending out notifications to the UI and the other is the email-notification consumer responsible for sending out emails. However we have wrapped the logic of both consumers into one single facility(notification), thanks to the multiple-consumer options provided by RabbitMQ. So, we have one multiple consumer which fans out messages to two consumers mentioned above.
You can go into the site/
folder of the VM and just command
.bin/console rabbitmq:multiple-consumer notification
and boom! That’s it! Both the consumers are active as a single daemon waiting for your notifications on the queue to execute them.
This is a new feature that we have added this year. Now, you can test notification consumers out there by sending out notifications directly from your cli inside the VM. The command
.bin/console librecores:send-notification
takes in four arguments.
Be careful of the Notification Type as the consumers are programmed only to execute a certain type of notifications only. They return false in all other cases.
So, you see unseen notifications on the dropdown, what if you clicked it mark as seen by accident? Coming to that well, what if I told you that you dont need to worry cause we got your back here. There is a notification inbox in the website aptly tailored to keep a list of all your(user’s) important notifications, even those which you have marked as seen also. You can remove notifications from here if you want your inbox to be well organised with fresh notifications only.
Now you can edit your notification settings in your user profile settings if you want to opt out of some kind of notification. We have added this new feature to make user personalisation even more important as this project of mine is mostly aimed at user interactivity and experience. Notification settings are placed in /user/settings/
and all the details are mentioned on the page itself.
So, yeah. It was a wonderful experience of learning and coding. After the first evaluations, we have to prepare for second round of coding and my goals are:
Peace!
This blog belongs to Aquib Baig who is a Web Developer and Architect at Zairza. Apart from writing code, I like to play soccer, listen to music and play video games. I am currently working as a summer intern at the umbrella organisation "FOSSi Foundation" under Google Summer Of Code. Follow me on Github