You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 messageif ($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?
The text was updated successfully, but these errors were encountered:
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:
Do you think adding
getCallback
method is an option?The text was updated successfully, but these errors were encountered: