10
10
use ReflectionException ;
11
11
use yii \base \Action ;
12
12
use yii \console \Controller ;
13
+ use yii \console \ExitCode ;
13
14
use yii \helpers \Console ;
14
15
15
16
/**
@@ -101,7 +102,7 @@ public function actionConsume(string $name): int
101
102
{
102
103
$ this ->stderr (Console::ansiFormat ("Consumer ` {$ name }` doesn't exist: {$ e ->getMessage ()}\n" , [Console::FG_RED ]));
103
104
104
- return self :: EXIT_CODE_ERROR ;
105
+ return ExitCode:: UNSPECIFIED_ERROR ;
105
106
}
106
107
107
108
$ this ->validateConsumerOptions ($ consumer );
@@ -111,7 +112,7 @@ public function actionConsume(string $name): int
111
112
}
112
113
$ consumer ->consume ($ this ->messagesLimit );
113
114
114
- return self :: EXIT_CODE_NORMAL ;
115
+ return ExitCode:: OK ;
115
116
}
116
117
117
118
/**
@@ -136,15 +137,15 @@ public function actionPublish(string $producerName, string $exchangeName, string
136
137
{
137
138
$ this ->stderr (Console::ansiFormat ("Producer ` {$ producerName }` doesn't exist: {$ e ->getMessage ()}\n" , [Console::FG_RED ]));
138
139
139
- return self :: EXIT_CODE_ERROR ;
140
+ return ExitCode:: UNSPECIFIED_ERROR ;
140
141
}
141
142
142
143
$ data = '' ;
143
144
if (posix_isatty (STDIN ))
144
145
{
145
146
$ this ->stderr (Console::ansiFormat ("Please pipe in some data in order to send it. \n" , [Console::FG_RED ]));
146
147
147
- return self :: EXIT_CODE_ERROR ;
148
+ return ExitCode:: UNSPECIFIED_ERROR ;
148
149
}
149
150
while (!feof (STDIN ))
150
151
{
@@ -153,7 +154,7 @@ public function actionPublish(string $producerName, string $exchangeName, string
153
154
$ producer ->publish ($ data , $ exchangeName , $ routingKey );
154
155
$ this ->stdout ("Message was successfully published. \n" , Console::FG_GREEN );
155
156
156
- return self :: EXIT_CODE_NORMAL ;
157
+ return ExitCode:: OK ;
157
158
}
158
159
159
160
/**
@@ -175,11 +176,11 @@ public function actionDeclareAll(string $connectionName = Configuration::DEFAULT
175
176
Console::ansiFormat ("All configured entries was successfully declared. \n" , [Console::FG_GREEN ])
176
177
);
177
178
178
- return self :: EXIT_CODE_NORMAL ;
179
+ return ExitCode:: OK ;
179
180
}
180
181
$ this ->stderr (Console::ansiFormat ("No queues, exchanges or bindings configured. \n" , [Console::FG_RED ]));
181
182
182
- return self :: EXIT_CODE_ERROR ;
183
+ return ExitCode:: UNSPECIFIED_ERROR ;
183
184
}
184
185
185
186
/**
@@ -201,12 +202,12 @@ public function actionDeclareExchange(
201
202
{
202
203
$ this ->stderr (Console::ansiFormat ("Exchange ` {$ exchangeName }` is already exists. \n" , [Console::FG_RED ]));
203
204
204
- return self :: EXIT_CODE_ERROR ;
205
+ return ExitCode:: UNSPECIFIED_ERROR ;
205
206
}
206
207
$ routing ->declareExchange ($ exchangeName );
207
208
$ this ->stdout (Console::ansiFormat ("Exchange ` {$ exchangeName }` was declared. \n" , [Console::FG_GREEN ]));
208
209
209
- return self :: EXIT_CODE_NORMAL ;
210
+ return ExitCode:: OK ;
210
211
}
211
212
212
213
/**
@@ -228,12 +229,12 @@ public function actionDeclareQueue(
228
229
{
229
230
$ this ->stderr (Console::ansiFormat ("Queue ` {$ queueName }` is already exists. \n" , [Console::FG_RED ]));
230
231
231
- return self :: EXIT_CODE_ERROR ;
232
+ return ExitCode:: UNSPECIFIED_ERROR ;
232
233
}
233
234
$ routing ->declareQueue ($ queueName );
234
235
$ this ->stdout (Console::ansiFormat ("Queue ` {$ queueName }` was declared. \n" , [Console::FG_GREEN ]));
235
236
236
- return self :: EXIT_CODE_NORMAL ;
237
+ return ExitCode:: OK ;
237
238
}
238
239
239
240
/**
@@ -253,15 +254,15 @@ public function actionDeleteAll(string $connection = Configuration::DEFAULT_CONN
253
254
{
254
255
$ this ->stderr (Console::ansiFormat ("Aborted. \n" , [Console::FG_RED ]));
255
256
256
- return self :: EXIT_CODE_ERROR ;
257
+ return ExitCode:: UNSPECIFIED_ERROR ;
257
258
}
258
259
}
259
260
$ conn = \Yii::$ app ->rabbitmq ->getConnection ($ connection );
260
261
$ routing = \Yii::$ app ->rabbitmq ->getRouting ($ conn );
261
262
$ routing ->deleteAll ();
262
263
$ this ->stdout (Console::ansiFormat ("All configured entries was deleted. \n" , [Console::FG_GREEN ]));
263
264
264
- return self :: EXIT_CODE_NORMAL ;
265
+ return ExitCode:: OK ;
265
266
}
266
267
267
268
/**
@@ -284,15 +285,15 @@ public function actionDeleteExchange(
284
285
{
285
286
$ this ->stderr (Console::ansiFormat ("Aborted. \n" , [Console::FG_RED ]));
286
287
287
- return self :: EXIT_CODE_ERROR ;
288
+ return ExitCode:: UNSPECIFIED_ERROR ;
288
289
}
289
290
}
290
291
$ conn = \Yii::$ app ->rabbitmq ->getConnection ($ connectionName );
291
292
$ routing = \Yii::$ app ->rabbitmq ->getRouting ($ conn );
292
293
$ routing ->deleteExchange ($ exchangeName );
293
294
$ this ->stdout (Console::ansiFormat ("Exchange ` {$ exchangeName }` was deleted. \n" , [Console::FG_GREEN ]));
294
295
295
- return self :: EXIT_CODE_NORMAL ;
296
+ return ExitCode:: OK ;
296
297
}
297
298
298
299
/**
@@ -315,7 +316,7 @@ public function actionDeleteQueue(
315
316
{
316
317
$ this ->stderr (Console::ansiFormat ("Aborted. \n" , [Console::FG_RED ]));
317
318
318
- return self :: EXIT_CODE_ERROR ;
319
+ return ExitCode:: UNSPECIFIED_ERROR ;
319
320
}
320
321
}
321
322
@@ -324,7 +325,7 @@ public function actionDeleteQueue(
324
325
$ routing ->deleteQueue ($ queueName );
325
326
$ this ->stdout (Console::ansiFormat ("Queue ` {$ queueName }` was deleted. \n" , [Console::FG_GREEN ]));
326
327
327
- return self :: EXIT_CODE_NORMAL ;
328
+ return ExitCode:: OK ;
328
329
}
329
330
330
331
/**
@@ -350,7 +351,7 @@ public function actionPurgeQueue(
350
351
{
351
352
$ this ->stderr (Console::ansiFormat ("Aborted. \n" , [Console::FG_RED ]));
352
353
353
- return self :: EXIT_CODE_ERROR ;
354
+ return ExitCode:: UNSPECIFIED_ERROR ;
354
355
}
355
356
}
356
357
@@ -359,7 +360,7 @@ public function actionPurgeQueue(
359
360
$ routing ->purgeQueue ($ queueName );
360
361
$ this ->stdout (Console::ansiFormat ("Queue ` {$ queueName }` was purged. \n" , [Console::FG_GREEN ]));
361
362
362
- return self :: EXIT_CODE_NORMAL ;
363
+ return ExitCode:: OK ;
363
364
}
364
365
365
366
/**
0 commit comments