This repository was archived by the owner on Apr 13, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +5
-48
lines changed Expand file tree Collapse file tree 4 files changed +5
-48
lines changed Original file line number Diff line number Diff line change @@ -66,10 +66,6 @@ require __DIR__ . '/vendor/autoload.php';
66
66
67
67
$broadcast = new Broadcast(RPC::create('tcp://127.0.0.1:6001'));
68
68
69
- if (!$broadcast->isAvailable()) {
70
- throw new \LogicException('The [broadcast] plugin not available');
71
- }
72
-
73
69
//
74
70
// Now we can send a message to a specific topic
75
71
//
Original file line number Diff line number Diff line change @@ -38,24 +38,11 @@ public function __construct(RPCInterface $rpc)
38
38
}
39
39
40
40
/**
41
- * {@inheritDoc}
41
+ * @deprecated Information about RoadRunner plugins is not available since RoadRunner version 2.2
42
42
*/
43
43
public function isAvailable (): bool
44
44
{
45
- try {
46
- /** @var array<string>|mixed $result */
47
- $ result = $ this ->rpc
48
- ->withCodec (new JsonCodec ())
49
- ->call ('informer.List ' , true );
50
-
51
- if (! \is_array ($ result )) {
52
- return false ;
53
- }
54
-
55
- return \in_array ('websockets ' , $ result , true );
56
- } catch (\Throwable $ e ) {
57
- return false ;
58
- }
45
+ throw new \RuntimeException (\sprintf ('%s::isAvailable method is deprecated. ' , self ::class));
59
46
}
60
47
61
48
/**
Original file line number Diff line number Diff line change 20
20
*/
21
21
interface BroadcastInterface
22
22
{
23
- /**
24
- * Returns information about whether a broadcast plugin is available.
25
- *
26
- * @return bool
27
- */
28
- public function isAvailable (): bool ;
29
-
30
23
/**
31
24
* Method to send messages to the required topic (channel).
32
25
* <code>
Original file line number Diff line number Diff line change @@ -37,29 +37,10 @@ public function testFactoryCreation(): void
37
37
38
38
public function testIsAvailable (): void
39
39
{
40
- $ factory = $ this ->broadcast (['informer.List ' => '["websockets"] ' ]);
41
- $ this ->assertTrue ($ factory ->isAvailable ());
42
- }
43
-
44
- public function testNotAvailable (): void
45
- {
46
- $ factory = $ this ->broadcast (['informer.List ' => '[] ' ]);
47
- $ this ->assertFalse ($ factory ->isAvailable ());
48
- }
49
-
50
- public function testNotAvailableOnNonArrayResponse (): void
51
- {
52
- $ factory = $ this ->broadcast (['informer.List ' => '42 ' ]);
53
- $ this ->assertFalse ($ factory ->isAvailable ());
54
- }
55
-
56
- public function testNotAvailableOnErrorResponse (): void
57
- {
58
- $ factory = $ this ->broadcast (['informer.List ' => (static function () {
59
- throw new \Exception ();
60
- })]);
40
+ $ this ->expectException (\RuntimeException::class);
41
+ $ this ->expectErrorMessage ('Spiral\RoadRunner\Broadcast\Broadcast::isAvailable method is deprecated. ' );
61
42
62
- $ this ->assertFalse ( $ factory ->isAvailable () );
43
+ $ this ->broadcast () ->isAvailable ();
63
44
}
64
45
65
46
public function testPublishingSingleMessage (): void
You can’t perform that action at this time.
0 commit comments