Menu

iTop Trigger with AMQP Fails in Docker Sync: 'AMQPConnection' Class Not Found

Marah Alh
2025-07-22
2025-07-22
  • Marah Alh

    Marah Alh - 2025-07-22

    Good day dears,

    I developed a new extension that work on (onCreateObject) trigger:
    this extension use amqp to send a message to RabbitMQ.
    I have two cases:
    1- when I run iTop locally (xamp) and create a new Server from console or from sync the trigger work and send the message to RMQ.
    2- when I run iTop as a docker image and create a new Server from console the trigger work and send the message to RMQ, but from sync and I got bellow error:

    2025-07-21 10:13:13 | Error   | 51    | Uncaught Error: Class "AMQPConnection" not found in /var/www/html/env-production/itop_ci_trigger_mgmt/main.itop_ci_trigger_mgmt.php:137
    Stack trace:
    #0 /var/www/html/env-production/itop_ci_trigger_mgmt/main.itop_ci_trigger_mgmt.php(87): CI_Action->_DoExecute()
    #1 /var/www/html/core/trigger.class.inc.php(125): CI_Action->DoExecute()
    #2 /var/www/html/core/trigger.class.inc.php(255): Trigger->DoActivate()
    #3 /var/www/html/core/dbobject.class.php(3498): TriggerOnObject->DoActivate()
    #4 /var/www/html/application/cmdbabstract.class.inc.php(4549): DBObject->PostInsertActions()
    #5 /var/www/html/core/dbobject.class.php(3459): cmdbAbstractObject->PostInsertActions()
    #6 /var/www/html/application/cmdbabstract.class.inc.php(4532): DBObject->DBInsertNoReload()
    #7 /var/www/html/core/dbobject.class.php(3182): cmdbAbstractObject->DBInsertNoReload()
    #8 /var/www/html/synchro/synchrodatasource.class.inc.php(2506): DBObject->DBInsert()
    #9 /var/www/html/synchro/synchrodatasource.class.inc.php(2265): SynchroReplica->CreateObjectFromReplica()
    #10 /var/www/html/synchro/synchrodatasource.class.inc.php(3550): SynchroReplica->Synchro()
    #11 /var/www/html/synchro/synchrodatasource.class.inc.php(3293): SynchroExecution->DoJob2CreateOrUpdateItopObjects()
    #12 /var/www/html/synchro/synchrodatasource.class.inc.php(3143): SynchroExecution->DoSynchronize()
    #13 /var/www/html/synchro/synchro_import.php(737): SynchroExecution->Process()
    #14 {main}
      thrown | IssueLog |||
    array (
      'type' => 1,
      'file' => '/var/www/html/env-production/itop_ci_trigger_mgmt/main.itop_ci_trigger_mgmt.php',
      'line' => 137,
    )
    

    from extension:

     $connection = new AMQPConnection([
        'host' => $this->Get('host'),
        'port' => $this->Get('port'),
        'vhost' => '/',
        'login' => $this->Get('login'),
        'password' => $this->Get('password')
    ]);
    

    iTop version: 3.1.1
    Mariadb: 11.5.2

     
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2025-07-22

    You'll need to debug your own custom code; as it seems PHP can't find your AMQPConnection class.

     
    • Marah Alh

      Marah Alh - 2025-07-22

      The AMQP message is sent successfully in the following cases:

      When the CI (Configuration Item) is created from the iTop UI
      
      When the CI is created via CSV synchronization on Windows
      

      However, the message fails to send only when the CI is created via CSV synchronization inside the Docker container, where the error Class "AMQPConnection" not found is triggered.

      I checked that amqp is enabled in fpm/php.ini and in cli/php.ini.

       
      • Stephen Abello

        Stephen Abello - 2025-07-22

        Are you calling your CSV synchronization in CLI ? Are you sure the right php binary is used and has your php extension loaded ?

         
  • Marah Alh

    Marah Alh - 2025-07-22

    In my .NET service, I initiate the synchronization by executing the following PHP command:

    string command = "php -q /var/www/html/synchro/synchro_import.php --auth_user=" + iTop_user + " --auth_pwd='" + iTop_password + "' --data_source_id=" +
                     dataSource.objects.SynchroDataSource.fields.id + " --csvfile=/app/CSV_files/" + sync_msg.ci_csvfilename;
    

    The synchronization runs successfully, and all items are created as expected in iTop.
    However, when the OnObjectCreate trigger is executed, it fails with the following error: Class "AMQPConnection" not found.

    I check this:
    * php -r "var_dump(class_exists('AMQPConnection'));"
    bool(true)

    • extension=amqp.so is loaded in "/etc/php/8.1/cli/php.ini" and in "/etc/php/8.1/fpm/php.ini"
     

    Last edit: Marah Alh 2025-07-22

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.