-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.php
More file actions
34 lines (27 loc) · 1.06 KB
/
Copy pathcommon.php
File metadata and controls
34 lines (27 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
declare(strict_types=1);
use Zlikavac32\BeanstalkdLib\Adapter\PHP\Socket\NativePHPSocket;
use Zlikavac32\BeanstalkdLib\Adapter\Symfony\Yaml\SymfonyYamlParser;
use Zlikavac32\BeanstalkdLib\InterruptHandler\GracefulExitInterruptHandler;
use Zlikavac32\BeanstalkdLib\Protocol\ProtocolOverSocket;
use Zlikavac32\BeanstalkdLib\Protocol\StateAwareProtocol;
use Zlikavac32\BeanstalkdLib\Socket\LazySocket;
require_once __DIR__.'/../vendor/autoload.php';
// We create lazy native socket
$socket = new LazySocket(
new NativePHPSocket(60000000)
);
// Yaml parser is used for Beanstalkd protocol parsing
$yamlParser = new SymfonyYamlParser();
// Graceful exit is shared to inspect whether graceful exit is in progress or not
$gracefulExit = new GracefulExitInterruptHandler();
// Protocol over socket that is aware of currently used tube
// So that multiple calls to useTube do not make additional
// requests to the server
$protocol = new StateAwareProtocol(
new ProtocolOverSocket(
$socket->open('127.0.0.1', 11300),
$gracefulExit,
$yamlParser
)
);