Skip to content

Instantly share code, notes, and snippets.

@Vasary
Created January 23, 2022 10:50
Show Gist options
  • Save Vasary/7fd0a32143a4ee0412ac729c9e2a06b9 to your computer and use it in GitHub Desktop.
Save Vasary/7fd0a32143a4ee0412ac729c9e2a06b9 to your computer and use it in GitHub Desktop.
<?php
public function consume(ConsumerInterface $consumer, AbstractQueueName $queueName): void
{
$consumerIdentified = (string)Uuid::uuid4();
$this->channel->qos(0, 10, false);
$this->channel->consume(
fn(Message $message) => $this->handle($message, $consumer),
$queueName,
$consumerIdentified,
false
);
while ($this->channel->isOpen()) {
$this->channel->wait();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment