Message Queue integration

Hi,

I need to integrate a SuiteCRM instance with another database. I would like to use a message queuing system for this (like RabbitMQ).

When a new contact record is added to the other database a message (containing the record details) will automatically be produced and sent to a queue. I want to build a mechanism within SuiteCRM which will poll this queue for new messages. When it finds a new message it should add the new contact to its own database using the API.

There is a php library for rabbitmq. Using this it is easy to write a “message consumer” script to poll for new messages, as explained here.

I also need to do the opposite. i.e. when a certain transaction is added for a given contact in Suite CRM, I need to automatically send a message to the queue, which the other database will consume.

Is it possible to customize SuiteCRM to enable this? I guess the second function could be accomplished with logic hooks on the after_save event. However, the message consumer is a process that needs to be initiated when SuiteCRM starts up, and terminated when SuiteCRM shuts down. Which files do I need to edit to make this work?

Pls note that I actually have a little more complex situation involving data syncing between multiple databases, but I have simplified my example for the sake of clarity.

Kind Regards

Swami