c11c323a305a388659864db6196e387f288353d6
\345\237\272\347\241\200APP/RabbitMQ APP.md
| ... | ... | @@ -6,7 +6,7 @@ App [[sie-snest-rabbitmq-v1.0.0.RELEASE.jar|/uploads/RabbitMQ/sie-snest-rabbitmq |
| 6 | 6 | |
| 7 | 7 | ## 添加配置 |
| 8 | 8 | |
| 9 | -不推荐使用,在 `application.properties` 配置文件添加以下配置。<br> |
|
| 9 | +不推荐使用:在 `application.properties` 配置文件添加以下配置。<br> |
|
| 10 | 10 | 因为如果需要修改配置,需要重启环境。 |
| 11 | 11 | |
| 12 | 12 | ```properties |
| ... | ... | @@ -62,6 +62,23 @@ rabbitmq.password=password |
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | ``` |
| 65 | +## 添加启动事件 |
|
| 66 | + |
|
| 67 | +在 `app.json` 中添加启动事件,在应用启动的时候注册消费者。<br> |
|
| 68 | +下图中的“"RabbitMqTest::registerConsumer"” |
|
| 69 | + |
|
| 70 | +```json |
|
| 71 | +{ |
|
| 72 | + "name": "rabbitmq-test", |
|
| 73 | + "displayName": "RabbitMQ测试", |
|
| 74 | + "dependencies": ["base-rabbitmq"], |
|
| 75 | + "events":{ |
|
| 76 | + "startUp": [ |
|
| 77 | + "RabbitMqTest::registerConsumer" |
|
| 78 | + ] |
|
| 79 | + } |
|
| 80 | +} |
|
| 81 | +``` |
|
| 65 | 82 | |
| 66 | 83 | ## 编写测试代码 |
| 67 | 84 | |
| ... | ... | @@ -104,19 +121,3 @@ public class RabbitMqTest extends BaseModel<RabbitMqTest> { |
| 104 | 121 | - publishChangeNameEvent:用于发送事件 |
| 105 | 122 | - handleChangeNameEvent:业务中处理事件的逻辑 |
| 106 | 123 | |
| 107 | -## 添加启动事件 |
|
| 108 | - |
|
| 109 | -在 `app.json` 中添加启动事件,在应用启动的时候注册消费者。 |
|
| 110 | - |
|
| 111 | -```json |
|
| 112 | -{ |
|
| 113 | - "name": "rabbitmq-test", |
|
| 114 | - "displayName": "RabbitMQ测试", |
|
| 115 | - "dependencies": ["base-rabbitmq"], |
|
| 116 | - "events":{ |
|
| 117 | - "startUp": [ |
|
| 118 | - "RabbitMqTest::registerConsumer" |
|
| 119 | - ] |
|
| 120 | - } |
|
| 121 | -} |
|
| 122 | -``` |
|
| ... | ... | \ No newline at end of file |