Today I have prepared not a simple article for you. I have recorded a video for you with detailed instructions on how to connect the queue system to Vtiger and make it truly asynchronous.
What is RabbitMQ and what it is for, I described in detail in the previous article. In this article and video, we will look at everything in practice - we will connect Vtiger and RabbitMQ, we will show how to exchange data between services. In our example, we will show the simplest but practical examples. We will send the created contacts to an external service, as well as save new contacts created in the external service. Finally, we'll show you how to achieve asynchronous operation with the queuing system.
The advantage of RabbitMQ is its simplicity and speed. In daily communication, people greet each other, exchange information, say goodbye, or end the conversation and move on. Low-level TCP connections behave appropriately, but not lightweight channels on RabbitMQ. Applications that communicate with the queuing system must establish a persistent connection to the message broker. Once the connection is established, a channel is created through which messages are sent or received.
After demonstrating the fundamental possibilities, we will show how a broker uses an exchange to determine where to deliver a particular message. The exchange acts as a postman - he decides where to deliver a particular letter and users can receive it later.
By the end of the video, you will have a basic understanding of Message Queuing, how to create communications between applications, and how to develop asynchronous applications.
This video is one of four in a series of courses "Integration of VtigerCRM with RabbitMQ". In this video, we will deploy the project, connect RabbitMQ to VtigerCRM, create a test project in Laravel and try to send the first contacts from Vtiger to Laravel via RabbitMQ.
Messages can be sent accross languages, platforms, and operating systems. You can choose from a number of different client libraries for different languages. There are a lots of client libraries out there, but we used php-amqplib for our demo purposes.
In this first video I will show to you that every AMQP protocol-related operation occurs over a channel. The channel instances are created by the connection instance. As described, a channel is virtual connection inside the TCP connection. All operations performed by a client happened on a channel, queues are declared on channel, and messages are sent over channels.
A channel never exists on its own. It's always in the context of a connection.
Channels in a connection are closed once the connection is closed or when a channel error occurs. Client library allow us to observe and reset channel exception.
More exceptions are usually thrown at a channel level than at the connection level. Channel-level exceptions often indicate errors the application can recover from, such as, when it has no permissions, or when attempting to consume from a deleted queue. Any attempted operation on a closed channel will also fail with an exception.
Even though channel instances are technically thread-safe, it is strongly recommended to avoid having several threads that are using the same channel concurrently.
For a quick dive into the topic, we touched on the following aspects in this course:
- Deploying the project and configuring Vtiger for further development.
- Fast creation of a client application in Laravel.
- We send contacts created in Laravel to Vtiger through the message queue.
- We send changes made in CRM to client applications.
- We turn Vtiger into an asynchronous system, thereby speeding up its work.
If you watched this video, go to second episode, where we will try to implement update functionality in Laravel