You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$context = (new PhpFpmConnectionFactory('tcp://localhost:9000'))->createContext();
41
+
42
+
$queue = $context->createQueue(__FILE__);
43
+
44
+
$consumer = $context->createConsumer($queue);
45
+
46
+
if ($message = $consumer->receiveNoWait()) {
47
+
// process message
48
+
49
+
$consumer->acknowledge($message);
50
+
}
51
+
```
52
+
53
+
Start PHP-FPM:
54
+
55
+
```bash
56
+
docker run -v `pwd`:/app -p 9000:9000 php:7.2-fpm
57
+
```
58
+
59
+
Send a message:
60
+
61
+
```bash
62
+
php sender.php
63
+
```
64
+
65
+
## Credits
66
+
67
+
Inspired by Benjamin post [Using php-fpm as a simple built-in async queue](https://tideways.com/profiler/blog/using-php-fpm-as-a-simple-built-in-async-queue)
0 commit comments