Skip to content

Commit

Permalink
Performance optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Shabouta authored and zloyuser committed Jan 15, 2019
1 parent 61f3bb1 commit 4f60fb8
Show file tree
Hide file tree
Showing 6 changed files with 422 additions and 300 deletions.
28 changes: 7 additions & 21 deletions examples/basic.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,15 @@
/** @var Channel $channel */
$channel = yield $client->channel();

yield $channel->queueDeclare('test_queue', false, false, false, true);
yield $channel->queueDeclare('basic_queue', false, false, false, true);

$body = \str_repeat("a", 10 << 20); // 10 MiB
$body = '';

yield $channel->publish($body, '', 'test_queue');
for ($i = 0; $i < 10; $i++) {
yield $channel->publish("test_$i", '', 'basic_queue');
}

yield $channel->consume(function (Message $message, Channel $channel) use ($body, $client) {
echo 'YAA!';
yield $channel->consume(function (Message $message, Channel $channel) {
echo $message->content() . \PHP_EOL;

yield $channel->ack($message);
// yield $client->disconnect();
}, 'test_queue');
//
// yield $channel->queueDeclare('basic_queue', false, false, false, true);
//
// for ($i = 0; $i < 10; $i++) {
// yield $channel->publish("test_$i", '', 'basic_queue');
// }
//
// yield $channel->consume(function (Message $message, Channel $channel) {
// echo $message->content() . \PHP_EOL;
//
// yield $channel->ack($message);
// }, 'basic_queue');
}, 'basic_queue');
});
Loading

0 comments on commit 4f60fb8

Please sign in to comment.