@@ -7,8 +7,20 @@ class Config
77 const PARAMETER_TOPIC_NAME = 'enqueue.topic_name ' ;
88 const PARAMETER_COMMAND_NAME = 'enqueue.command_name ' ;
99 const PARAMETER_PROCESSOR_NAME = 'enqueue.processor_name ' ;
10+
11+ /**
12+ * @deprecated
13+ */
1014 const PARAMETER_PROCESSOR_QUEUE_NAME = 'enqueue.processor_queue_name ' ;
15+
16+ /**
17+ * @deprecated
18+ */
1119 const DEFAULT_PROCESSOR_QUEUE_NAME = 'default ' ;
20+
21+ /**
22+ * @deprecated
23+ */
1224 const COMMAND_TOPIC = '__command__ ' ;
1325
1426 /**
@@ -48,12 +60,29 @@ class Config
4860
4961 public function __construct (string $ prefix , string $ appName , string $ routerTopicName , string $ routerQueueName , string $ defaultProcessorQueueName , string $ routerProcessorName , array $ transportConfig = [])
5062 {
51- $ this ->prefix = $ prefix ;
52- $ this ->appName = $ appName ;
53- $ this ->routerTopicName = $ routerTopicName ;
54- $ this ->routerQueueName = $ routerQueueName ;
55- $ this ->defaultProcessorQueueName = $ defaultProcessorQueueName ;
56- $ this ->routerProcessorName = $ routerProcessorName ;
63+ $ this ->prefix = trim ($ prefix );
64+ $ this ->appName = trim ($ appName );
65+
66+ $ this ->routerTopicName = trim ($ routerTopicName );
67+ if (empty ($ this ->routerTopicName )) {
68+ throw new \InvalidArgumentException ('Router topic is empty. ' );
69+ }
70+
71+ $ this ->routerQueueName = trim ($ routerQueueName );
72+ if (empty ($ this ->routerQueueName )) {
73+ throw new \InvalidArgumentException ('Router queue is empty. ' );
74+ }
75+
76+ $ this ->defaultProcessorQueueName = trim ($ defaultProcessorQueueName );
77+ if (empty ($ this ->defaultProcessorQueueName )) {
78+ throw new \InvalidArgumentException ('Default processor queue name is empty. ' );
79+ }
80+
81+ $ this ->routerProcessorName = trim ($ routerProcessorName );
82+ if (empty ($ this ->routerProcessorName )) {
83+ throw new \InvalidArgumentException ('Router processor name is empty. ' );
84+ }
85+
5786 $ this ->transportConfig = $ transportConfig ;
5887 }
5988
@@ -62,6 +91,11 @@ public function getPrefix(): string
6291 return $ this ->prefix ;
6392 }
6493
94+ public function getSeparator (): string
95+ {
96+ return '. ' ;
97+ }
98+
6599 public function getAppName (): string
66100 {
67101 return $ this ->appName ;
@@ -87,16 +121,27 @@ public function getRouterProcessorName(): string
87121 return $ this ->routerProcessorName ;
88122 }
89123
124+ /**
125+ * @deprecated
126+ */
90127 public function createTransportRouterTopicName (string $ name ): string
91128 {
92129 return strtolower (implode ('. ' , array_filter ([trim ($ this ->prefix ), trim ($ name )])));
93130 }
94131
132+ /**
133+ * @deprecated
134+ */
95135 public function createTransportQueueName (string $ name ): string
96136 {
97137 return strtolower (implode ('. ' , array_filter ([trim ($ this ->prefix ), trim ($ this ->appName ), trim ($ name )])));
98138 }
99139
140+ /**
141+ * @deprecated
142+ *
143+ * @param null|mixed $default
144+ */
100145 public function getTransportOption (string $ name , $ default = null )
101146 {
102147 return array_key_exists ($ name , $ this ->transportConfig ) ? $ this ->transportConfig [$ name ] : $ default ;
0 commit comments