|
|
@@ -1,5 +1,4 @@
|
|
|
<?php
|
|
|
-use mikemadisonweb\rabbitmq\Configuration;
|
|
|
/**
|
|
|
* rabbitmq的配置
|
|
|
*/
|
|
|
@@ -37,12 +36,12 @@ $rabbitmq = [
|
|
|
*/
|
|
|
'exchanges' => [
|
|
|
[
|
|
|
- 'name' => 'ex1',
|
|
|
- 'type' => 'direct'
|
|
|
+ 'name' => 'ex_1',
|
|
|
+ 'type' => 'direct' // direct
|
|
|
],
|
|
|
[
|
|
|
- 'name' => 'ex2',
|
|
|
- 'type' => 'topic',
|
|
|
+ 'name' => 'topic_ex_1',
|
|
|
+ 'type' => 'topic', // topic
|
|
|
'passive' => false,
|
|
|
'durable' => true,
|
|
|
'auto_delete' => false,
|
|
|
@@ -61,9 +60,6 @@ $rabbitmq = [
|
|
|
[
|
|
|
'name' => 'queue_1',
|
|
|
'passive' => false,
|
|
|
- // Queue can be configured here the way you want it:
|
|
|
- //'durable' => true,
|
|
|
- //'auto_delete' => false,
|
|
|
],
|
|
|
[
|
|
|
'name' => 'queue_2',
|
|
|
@@ -76,6 +72,17 @@ $rabbitmq = [
|
|
|
'ticket' => null,
|
|
|
'declare' => true,
|
|
|
],
|
|
|
+ [
|
|
|
+ 'name' => 'queue_3',
|
|
|
+ 'passive' => false,
|
|
|
+ 'durable' => true,
|
|
|
+ 'exclusive' => false,
|
|
|
+ 'auto_delete' => false,
|
|
|
+ 'nowait' => false,
|
|
|
+ 'arguments' => null,
|
|
|
+ 'ticket' => null,
|
|
|
+ 'declare' => true,
|
|
|
+ ],
|
|
|
],
|
|
|
|
|
|
/**
|
|
|
@@ -85,13 +92,18 @@ $rabbitmq = [
|
|
|
'bindings' => [
|
|
|
[
|
|
|
'queue' => 'queue_1',
|
|
|
- 'exchange' => 'ex1',
|
|
|
- 'routing_keys' => ['route1'],
|
|
|
+ 'exchange' => 'ex_1',
|
|
|
+ 'routing_keys' => ['route_1'],
|
|
|
],
|
|
|
[
|
|
|
'queue' => 'queue_2',
|
|
|
- 'exchange' => 'ex2',
|
|
|
- 'routing_keys' => ['route1', 'route2'],
|
|
|
+ 'exchange' => 'topic_ex_1',
|
|
|
+ 'routing_keys' => ['route_1', 'route_prefix.*', '*.route_suffix', '*.*.last', '*'],
|
|
|
+ ],
|
|
|
+ [
|
|
|
+ 'queue' => 'queue_3',
|
|
|
+ 'exchange' => 'topic_ex_1',
|
|
|
+ 'routing_keys' => ['route_3', 'route3_prefix.*', '*.route_suffix', '*.*.last'],
|
|
|
],
|
|
|
],
|
|
|
|
|
|
@@ -104,7 +116,7 @@ $rabbitmq = [
|
|
|
],
|
|
|
[
|
|
|
'name' => 'producer_2',
|
|
|
- 'connection' => Configuration::DEFAULT_CONNECTION_NAME,
|
|
|
+ 'connection' => 'default',
|
|
|
'safe' => true,
|
|
|
'content_type' => 'text/plain',
|
|
|
'delivery_mode' => 2,
|
|
|
@@ -124,7 +136,7 @@ $rabbitmq = [
|
|
|
],
|
|
|
[
|
|
|
'name' => 'consumer_2',
|
|
|
- 'connection' => Configuration::DEFAULT_CONNECTION_NAME,
|
|
|
+ 'connection' => 'default',
|
|
|
'callbacks' => [
|
|
|
'queue_2' => '\common\components\rabbitmq\consumer\PrintMsgConsumer',
|
|
|
],
|