-
-
Notifications
You must be signed in to change notification settings - Fork 87
/
WorkerMetadata.php
45 lines (39 loc) · 1.02 KB
/
WorkerMetadata.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
41
42
43
44
45
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Messenger;
/**
* @author Oleg Krasavin <[email protected]>
*/
final class WorkerMetadata
{
public function __construct(
private array $metadata,
) {
}
public function set(array $newMetadata): void
{
$this->metadata = array_merge($this->metadata, $newMetadata);
}
/**
* Returns the queue names the worker consumes from, if "--queues" option was used.
* Returns null otherwise.
*/
public function getQueueNames(): ?array
{
return $this->metadata['queueNames'] ?? null;
}
/**
* Returns an array of unique identifiers for transport receivers the worker consumes from.
*/
public function getTransportNames(): array
{
return $this->metadata['transportNames'] ?? [];
}
}