Skip to content
Advertisement

RabbitMQ and Yii console callback error

I am trying to get RabbitMQ working with the Yii console in order to send transactional emails, but I am experiencing problems with getting the PHP-AMQPLib library to work within Yii. My code is below:

JavaScript

When I try to execute this code from the command line as follows:

JavaScript

I receive the following error message:

JavaScript

Any idea what I may be doing wrong?

Advertisement

Answer

This error is happening because processMessage is an instance method of your object but the argument to basic_consume is expected to be a global PHP method.

See this thread for solutions: PHP Call a instance method with call_user_func within the same class

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement