Vtiger and RabbitMQ - Accept data from third-party applications

Vtiger and RabbitMQ - Accept data from third-party applications

We continue our master class on introducing asynchronous operations in VtigerCRM. In previous episodes we learned how to send data from Vtiger to queue and receive it in Laravel. Now let's look at the opposite scenario - we will read the messages in the queue and process them accordingly.

This is probably the most difficult stage in working with queues. Previously, everything was quite simple - we wrote handlers, they sent information about the event to RabbitMQ. But now we need to write a special script that will constantly listen queue and it is desirable that it can be managed not by cron, but by Supervisor.

The picture above shows a diagram of how our interaction with the queue will be built. RabbitMQ offers two ways to receive messages: we can request them ourselves from the application using the basic.get method, or the server can send them to us using the basic.consume method. The picture above shows just the second approach, which we will use.

The subscribe method we call adds the application to the queue and subscribes it to new messages.

When developing your application, make sure that the recipient is registered with the basic.consume method and not with basic.get. The second method is quite expensive and requires significant server resources.

With the subscription approach, messages are sent to the client from the broker as soon as they are available and the client is available to receive them. This makes it very fast and easy to process messages. In addition, using the subscribe approach means that the receiver is connected as long as the channel exists or until the client itself closes the connection.

Below you can see a detailed tutorial on how we can implement listening for messages in RabbitMQ and how we will handle them using the example of creating and updating contacts.

Before watching the video, make sure you read my previous posts and watch the introductory videos:

  1. How to install RabbitMQ
  2. How to connect RabbitMQ with VtigerCRM? How do I send data to the queue?
  3. How to update data in another application from Vtiger?

 

 

You almost done with this video course. Let's try to make vtiger async!

Popular Posts

My most popular posts

Maximum productivity on remote job
Business

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

Telegram
@sergeyem
Telephone
+4915211100235