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 am able to push the messages to the queue and I want to access all the messages and send the messages to the users dashboard or through SMS so I wanted to know how to get the content or all the message so that I can send them one by one to the users. Please help it is urgent.
Thank you
The text was updated successfully, but these errors were encountered:
You could call a function that just adds the messages to an array, then process it all in one go.
use App\Http\Controllers\Controller;
use Bschmitt\Amqp\Consumer;
use Bschmitt\Amqp\Amqp;
use Illuminate\Http\Request;
use PhpAmqpLib\Message\AMQPMessage;
class MyCoolController extends Controller {
private $messageBatch = [];
private function addMessageToBatch(AMQPMessage $message)
{
$this->messageBatch[] = $message;
}
private function sendMessagesViaSms()
{
//use $this->messageBatch here and do whatever with it
}
public function myCoolEntryPoint(Request $request, Amqp $consumer)
{
$consumer->consume('myfancyqueue', function (AMQPMessage $message, Consumer $resolver) {
$this->addMessageToBatch($message);
$resolver->acknowledge($message); //ack message
$resolver->stopWhenProcessed();
});
$this->sendMessagesViaSms();
}
}
Sorry if some of the formatting is wrong here, I don't have access to a proper editor at the minute ^^
I am able to push the messages to the queue and I want to access all the messages and send the messages to the users dashboard or through SMS so I wanted to know how to get the content or all the message so that I can send them one by one to the users. Please help it is urgent.
Thank you
The text was updated successfully, but these errors were encountered: