forked from php-amqplib/RabbitMqBundle
-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Labels
Description
I have a class (kind of message dealer) that centralises sending messages to rabbit. I’d like to move some part of more complicated calculations to queue but I have a problem to keep my tests as they are, since they expect results of some actions to have effect immediately (since the calculations are sync).
I know I could (and maybe should) change tests to test smaller bits of code that would get around it but I’d find it more practical to just call consumer’s callback synchronously (based on some config). All I need to do that is a way to get a consumer’s callback. So that I can do something like this:
// ... in a method for sending a message
if ($isRabbitDisabled) {
$consumer = $this->container->getService('rabbitmq.consumer.' . $key);
$msg = new \PhpAmqpLib\Message\AMQPMessage($encodedData);
call_user_func($consumer->getCallback());
return;
}Do you think adding getCallbackmethod is an option?
Reactions are currently unavailable