|
1 | 1 | #!/usr/bin/env php |
2 | | -<?php |
| 2 | +<?php declare(strict_types=1); |
3 | 3 |
|
4 | | -require \dirname(__DIR__) . '/vendor/autoload.php'; |
| 4 | +require dirname(__DIR__) . '/vendor/autoload.php'; |
5 | 5 |
|
6 | 6 | use Amp\Future; |
7 | 7 | use Amp\Postgres\PostgresConfig; |
|
19 | 19 |
|
20 | 20 | $listener1 = $pool->listen($channel1); |
21 | 21 |
|
22 | | -\printf("Listening on channel '%s'\n", $listener1->getChannel()); |
| 22 | +printf("Listening on channel '%s'\n", $listener1->getChannel()); |
23 | 23 |
|
24 | 24 | $listener2 = $pool->listen($channel2); |
25 | 25 |
|
26 | | -\printf("Listening on channel '%s'\n", $listener2->getChannel()); |
| 26 | +printf("Listening on channel '%s'\n", $listener2->getChannel()); |
27 | 27 |
|
28 | 28 | async(function () use ($pool, $listener1, $listener2, $channel1, $channel2): void { |
29 | 29 | $pool->notify($channel1, "Data 1.1"); |
|
38 | 38 |
|
39 | 39 | delay(0.5); |
40 | 40 |
|
41 | | - \printf("Unlistening from channel '%s'\n", $listener2->getChannel()); |
| 41 | + printf("Unlistening from channel '%s'\n", $listener2->getChannel()); |
42 | 42 | $listener2->unlisten(); |
43 | 43 |
|
44 | 44 | delay(0.5); |
|
47 | 47 |
|
48 | 48 | delay(0.5); |
49 | 49 |
|
50 | | - \printf("Unlistening from channel '%s'\n", $listener1->getChannel()); |
| 50 | + printf("Unlistening from channel '%s'\n", $listener1->getChannel()); |
51 | 51 | $listener1->unlisten(); |
52 | 52 | }); |
53 | 53 |
|
54 | 54 | $consumer = function (PostgresListener $listener): void { |
55 | 55 | /** @var PostgresNotification $notification */ |
56 | 56 | foreach ($listener as $notification) { |
57 | | - \printf( |
| 57 | + printf( |
58 | 58 | "Received notification from PID %d on channel '%s' with payload: %s\n", |
59 | 59 | $notification->pid, |
60 | 60 | $notification->channel, |
|
0 commit comments