rabbitmq – How to receive message and get it automatically when message on queue is fired in laravel

I am processing push queue (RabbitMQ) and receive message queue on laravel :

I handle push queue :

  public function pushQueue($data, $routingKey)
        $properties = [
            'content_type' => 'application/json',
        $message = Amqp::message(json_encode($data),$properties);
        Amqp::publish($routingKey, $message, [
            'exchange' => Queue::EXCHANGE,
            'exchange_type' => Queue::EXCHANGE_TYPE,

And now I have : $exchange="test.data" and routing_key = 'data.save'… Now I want to get the message from RabbitMQ to laravel, how do I do it?

And there is another problem that the message on the queue will be fired often, so is there any way to get the message automatically when there is a new message on the queue. Please help me. Thanks.

Read more here: Source link