如何批量接收消息
Closed this issue · 2 comments
hyperbolaa commented
$options = new ConsumerOptions();
$options->setConnectTimeout(3);
$options->setTopic(self::$topic);
$options->setSubscription(self::$sub);
$options->setSubscriptionType(SubscriptionType::Shared);
$options->setNackRedeliveryDelay(2);
$options->setReceiveQueueSize(16);//设置16
$options->setDeadLetterPolicy(2,self::$dead_topic,self::$sub);
$consumer = new Consumer(self::$url, $options);
$consumer->connect();
$message = $consumer->receive(true);
返回的$message还是单个消息
ikilobyte commented
$options->setReceiveQueueSize(16);
是配置协议层面,并不是批量接收消息,目前没有批量接收消息
hyperbolaa commented
好的