Post news RSS Cross Notifications (Drupal)

Before you continue reading, let me give you some piece of advice. This post contains high levels of freaking programming stuff, I take no responsability if a Code Worm appears in your brain and starts a lobotomy.

Posted by on


Goods news everyone!

Before you continue reading, let me give you some piece off advice. This post contains high levels of freaking programming stuff, I take no responsability if a Code Worm appears in your brain and starts a lobotomy.


We have mentioned this before, the relation between the web and the Formula Wincars game is transparent, and this is made on purpose. One of the biggest challenge we have encountered is exchanging relevant notifications and events between the two systems. For example, how would the web notice that a tournament has ended so we can publish an automatic post with all the information?

The brute-force answer is easy. Every certain time the game data is analyzed and the most relevant information is extracted. But this solution is not scalable even with the CERN computers. Why mining all the data If we can simply notify it when an event appears? Data mining is not necessary. And this is how Cross Notifications system has born.


Notify an event it’s really easy. When the event occurs, we write a notification in the data base with the required parameters. And same thing in the web side. Elegant, clean and suitable for everyone.

But how are this notifications showed to the players? We have been talking about the Game-side notification system in the past.

But what happens in the Drupal web? Here is where the magic starts.

In this systems, two popular Drupal modules come into play:

  1. Ultimate Cron that allows to execute individual Cron Jobs in parallel using
    configurable rules, load balancing and other interesting features.
  2. Rules allow automatize actions triggered by specific events.

The first step is to configure Ultimate Cron and add a new personalized Cron Job that looks up periodically the written notifications in the database. For every notification, a Rules custom event is triggered.


The second step is to create Rules that handle this events and to execute desired actions, or defined-by-design ones. There is no limit! This is a highly modularized system that it can scale to infinity.

One more thing for all of you that have knowledge in Drupal development. If you want to add a custom cron job, just create a new custom module and implement the hook_cronapi. And the same thing goes for adding Rules custom events. Just create another (or use the same module, depending on how organized you are) custom module
that defined them, it’s really easy.


Actions that are not defined in the Rules basic module or in extension modules like Rules Bonus Pack or Commerce Rules Extra, can be done via two different ways: adding a custom action via custom module or executing an ordinary PHP script that does the job.

See ya!

Comments
paulojlopes
paulojlopes

I didnt understand **** of what was said but I did notice that the last gif has the fingers press both Caps Lock and Shift and around 4 fingers pressing Space, whatever anime that is from didnt really thought of the usefullness of having 30 fingers for typing.

Reply Good karma Bad karma+2 votes
Guest
Guest

Mate, hands like that aren't for typin' IF YOU KNOW WHAT I'M SAYIN ;)

Reply Good karma Bad karma+1 vote
gghani Author
gghani

You're a detail-oriented guy indeed!!

Reply Good karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.