im进行发布订阅测试。我试图使用sleep(3)
来延迟queue:worker直到消耗完
但是它不起作用,睡眠只会延迟整个测试
$msg['token'] = $this->accessToken;
$msg['payload'] = [
'trxid' => "NORM-PURC-001",
'trx_amount' => 100000,
'items' => [
array( 'id'=>'SKU0001', 'name'=>'Simpati 100.000', 'price'=>100000, 'qty'=>1 )
]
];
$this->publish($msg);
public function publish($msg)
{
Amqp::publish('piggybank-transaction', json_encode($msg), [
'exchange' => 'piggybank',
'exchange_type' => 'direct'
]);
sleep(3);
}