使用PhpAmqpLib常用的2种连接rabbitmq的方式

发布时间 2023-06-24 15:54:30作者: sblack
#connect to AMQP broker at example.com
use PhpAmqpLib\Connection\AMQPStreamConnection;
$amqp = new AMQPStreamConnection('example.com', 5672, 'user', 'pwd','/host');

#SSL or secure connection
use phpAmqpLib\Connection\AMQSSLConnection;
$amqp = new AMQPSSLConnection('domain', 5671, 'user', 'pwd','/host',['dsn'=>'amqps:']);