1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
5
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
6
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
7
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
8
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
9
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
10
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
11
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
12
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
13
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
14
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
15
|
|
|
* |
16
|
|
|
* This software consists of voluntary contributions made by many individuals |
17
|
|
|
* and is licensed under the MIT license. |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @codeCoverageIgnore |
22
|
|
|
*/ |
23
|
|
|
namespace RabbitMqModule; |
24
|
|
|
|
25
|
|
|
use Zend\Console\Adapter\AdapterInterface; |
26
|
|
|
use Zend\ModuleManager\Feature\AutoloaderProviderInterface; |
27
|
|
|
use Zend\ModuleManager\Feature\ConfigProviderInterface; |
28
|
|
|
use Zend\ModuleManager\Feature\ConsoleBannerProviderInterface; |
29
|
|
|
use Zend\ModuleManager\Feature\ConsoleUsageProviderInterface; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Class Module. |
33
|
|
|
* |
34
|
|
|
* @codeCoverageIgnore |
35
|
|
|
*/ |
36
|
|
|
class Module implements |
37
|
|
|
AutoloaderProviderInterface, |
38
|
|
|
ConfigProviderInterface, |
39
|
|
|
ConsoleUsageProviderInterface, |
40
|
|
|
ConsoleBannerProviderInterface |
41
|
|
|
{ |
42
|
|
|
/** |
43
|
|
|
* Returns configuration to merge with application configuration. |
44
|
|
|
* |
45
|
|
|
* @return array|\Traversable |
46
|
|
|
*/ |
47
|
|
|
public function getConfig() |
48
|
|
|
{ |
49
|
|
|
return include __DIR__.'/../config/module.config.php'; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Return an array for passing to Zend\Loader\AutoloaderFactory. |
54
|
|
|
* |
55
|
|
|
* @return array |
56
|
|
|
*/ |
57
|
|
|
public function getAutoloaderConfig() |
58
|
|
|
{ |
59
|
|
|
return [ |
60
|
|
|
'Zend\Loader\StandardAutoloader' => [ |
61
|
|
|
'namespaces' => [ |
62
|
|
|
__NAMESPACE__ => __DIR__, |
63
|
|
|
], |
64
|
|
|
], |
65
|
|
|
]; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @param AdapterInterface $console |
70
|
|
|
* |
71
|
|
|
* @return array|string|null |
72
|
|
|
*/ |
73
|
|
|
public function getConsoleUsage(AdapterInterface $console) |
74
|
|
|
{ |
75
|
|
|
return [ |
76
|
|
|
'rabbitmq-module setup-fabric' => 'Sets up the Rabbit MQ fabric', |
77
|
|
|
'rabbitmq-module list consumers' => 'List available consumers', |
78
|
|
|
'rabbitmq-module consumer <name> [--without-signals|-w]' => 'Start a consumer by name', |
79
|
|
|
'rabbitmq-module rpc_server <name> [--without-signals|-w]' => 'Start a rpc server by name', |
80
|
|
|
'rabbitmq-module stdin-producer <name> [--route=] <msg>' => 'Send a message with a producer', |
81
|
|
|
]; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @param AdapterInterface $console |
86
|
|
|
* |
87
|
|
|
* @return string|null |
88
|
|
|
*/ |
89
|
|
|
public function getConsoleBanner(AdapterInterface $console) |
90
|
|
|
{ |
91
|
|
|
return 'RabbitMQ Module'; |
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|