forked from azjezz/psl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSenderInterface.php
40 lines (36 loc) · 979 Bytes
/
SenderInterface.php
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
35
36
37
38
39
40
<?php
declare(strict_types=1);
namespace Psl\Channel;
/**
* @template T
*
* @extends ChannelInterface<T>
*/
interface SenderInterface extends ChannelInterface
{
/**
* Send a message to the channel.
*
* If the channel is full, this method waits until there is space for a message.
*
* If the channel is closed, this method throws.
*
* @param T $message
*
* @throws Exception\ClosedChannelException If the channel is closed.
*/
public function send(mixed $message): void;
/**
* Receives a message from the channel immediately.
*
* If the channel is full, this method will throw an exception.
*
* If the channel is closed, this method throws.
*
* @param T $message
*
* @throws Exception\ClosedChannelException If the channel is closed.
* @throws Exception\FullChannelException If the channel is full.
*/
public function trySend(mixed $message): void;
}