php-amqplib Publish with connection recovery

57 views
Skip to first unread message

Ruben

unread,
Jun 10, 2019, 6:12:38 PM6/10/19
to php-amqplib-devel
Hi, i need keep open the connection and send many menssage async, my code is like this

$connection = $this->connect();//return new AMQPSSLConnection.......
 $channel
= $this->connection->channel();
 register_shutdown_function
([$this, 'shutdown'], $this->connection);
while(true){
       
//wait for messages
     
if( read_message_from_file){
               
...
               
......
               
............
               $channel
->basic_publish($msg, $exchange,$routingKey);

         
}
}
....close connection


my problem is that sometimes the connection closes, and the problem is that in the lapse that is reconnected many messages are lost, then I want to find a solution to this
Reply all
Reply to author
Forward
0 new messages