Asynchronous Vtiger with RabbitMQ

Asynchronous Vtiger with RabbitMQ

Presenting to your attention the last video from the course "Asynchronous Vtiger with RabbitMQ". This is perhaps the main and most interesting video from the course, in which we will implement asynchronous operations and the event system in Vtiger. And all this will happen asynchronously without loading the system.

In my practice, I often saw CRM systems that, when changing any record (for example, a deal), forced the user to wait a few seconds until the operation was completed. All this led to the general opinion that the system "slows down". The main reason for this is that developers run various handlers or launch heavy functions that performs hard calculation operations. For example, they recalculate the forecasted amount of potential, send API requests to the accounting system, and so on.

Sometimes, in order not to make the user wait, developers set up cron tasks, which run once a minute and perform operations in the background. From the user's point of view, this speeds up the system, but rather heavily loads the server. Since now we are forced to perform the same operation every time.

In previous articles, I already wrote about queues and the event system - this is a technology for indirect interaction between system modules or between other programs. Our CRM will send messages to the queue and other modules of the application will read these messages and execute them.

What benefits will it bring to us:

- The system works quickly from the user's point of view.

The main reason why queuing is useful is that you do not force users to wait for certain operations on the server to be performed before continuing.

For example, the user does not have to wait for the system to recalculate the profit on the deal after changing its status. Even if, in the opinion of the developer, this is done quickly, there may be cases when the calculation will take longer than necessary. In this case, after changing the status of the transaction, you can send a successful response so that the user can continue working, and the operation to recalculate the profit for the transaction can be started in the background in a separate process.

- Better error handling.

Queuing systems are lined up so that messages hang until they are processed. In case of an error, you can configure everything so that the system can retry the operation later. If the processing of a message fails with an error more than three times, we can save it to a separate table, so that the administrator can start it manually.

For example, if the task of an event is to send data to an accounting system that was offline at a certain point in time, you can configure message processing so they can repeat sending data after some time again.

- Scalability

For applications with unpredictable load, it is waste of money to allocate additional resources every time there is no load on the server. With queues, you can control the level at which scripts request messages in the queue.

If you allocate additional resources to this part, the system will request events more often, and if you limit it, the queue processing will be slower.

So, the introduction of a queue system allows you to significantly optimize the work of the CRM system, make it faster and more efficient. In the video under this article, you can see the implementation of the simplest example on RabbitMQ - the automatic creation of project tasks when creating a project. Of course, you can implement more complex implementations of this case.

Before watching the video, I recommend that you read the introductory materials:

  1. How to install RabbitMQ on your server
  2. How to connect RabbitMQ to Vtiger
  3. We send messages to RabbitMQ from Vtiger
  4. We accept messages from RabbitMQ to Vtiger

Happy viewing!



Popular Posts

My most popular posts

Maximum productivity on remote job

Maximum productivity on remote job

I started my own business and intentionally did my best to work from anywhere in the world. Sometimes I sit with my office with a large 27-inch monitor in my apartment in Cheboksary. Sometimes I’m in the office or in some cafe in another city.

Hello! I am Sergey Emelyanov and I am hardworker
Business PHP

Hello! I am Sergey Emelyanov and I am hardworker

I am a programmer. I am an entrepreneur in my heart. I started making money from the age of 11, in the harsh 90s, handing over glassware to a local store and exchanging it for sweets. I earned so much that was enough for various snacks.

Hire Professional CRM developer for $25 per hour

I will make time for your project. Knowledge of Vtiger CRM, SuiteCRM, Laravel, and Vue.js. I offer cooperation options that will help you take advantage of external experience, optimize costs and reduce risks. Full transparency of all stages of work and accounting for time costs. Pay only development working hours after accepting the task. Accept PayPal and Payoneer payment systems. How to hire professional developer? Just fill in the form