Commit d156a3bc by Sxy

docs: 文档

parent 27947086
#### 实现功能
* 消息请求失败重试
* 消息请求延时发送
#### 启动
> npm run start
>
> 默认 3000端口
#### API
##### 消息请求失败重试
> 重试的阶梯时间 在 setting中配置
请求路径:/sendRetryMessage
method : post
请求参数 :
| 参数 | 类型 | 是否必填 | 备注 |
| :-----: | :----: | :------: | :--------------------------------------------: |
| url | string | Y | 转发的请求地址 |
| method | string | N | 创建请求时使用的方法,默认 post |
| headers | object | N | 请求头, 默认 Content-Type': 'application/json' |
| params | object | N | `params` 是与请求一起发送的 URL 参数 |
| data | object | N | data 是作为请求体被发送的数据 |
| timeout | int | N | `timeout` 指定请求超时的秒数, 默认5s |
返回参数 :
```
{
"messageId": "cc6a5cb3-baef-4718-9420-09e54899b232"
}
```
##### 消息请求延时发送
请求路径:/sendDelayMessage
method : post
请求参数 :
| 参数 | 类型 | 是否必填 | 备注 |
| :-------: | :----: | :------: | :----------------------------------------------: |
| url | string | Y | 转发的请求地址 |
| method | string | N | 创建请求时使用的方法,默认 post |
| headers | object | N | 请求头, 默认 Content-Type': 'application/json' |
| params | object | N | `params` 是与请求一起发送的 URL 参数 |
| data | object | N | data 是作为请求体被发送的数据 |
| timeout | int | N | `timeout` 指定请求超时的秒数, 默认5s |
| delayTime | int | Y | 延时多长时间返送 , 单位s ,最长不能超过49小时 |
返回参数 :
```
{
"messageId": "cc6a5cb3-baef-4718-9420-09e54899b232"
}
```
......@@ -20,7 +20,7 @@ router.post('/sendRetryMessage', async (ctx, next) => {
})
/**
* 发送消息 - 队列
* 发送消息 - 延时队列
*/
router.post('/sendDelayMessage', async (ctx, next) => {
ctx.verifyParams({
......
......@@ -11,7 +11,7 @@ module.exports = {
vhost: '/',
},
PREFETCH: 5,
LADDERDELAYOPTIONSL: {
LADDERDELAYOPTIONSL: { // 重试功能配置
time: [3, 15, 30, 60],// 阶梯延时时间
lodderExchangeDLX: "lodder.exchange.dlx", // 延时交换器
lodderQueueKeyDLX: "lodder.queueKey.dlx", //lodder.queueKey.dlx.3 lodder.queueKey.dlx.15
......@@ -20,7 +20,7 @@ module.exports = {
consumerQueue: "consumer.queue",// 正常消费队列
consumerRoutingKey: "consumer.routingkey"
},
DELAYOPTIONSL: {
DELAYOPTIONSL: { // 延时功能配置
delayExchange: "delay.exchange",
delayQueue: "delay.queue",
delayRoutingKey: "delay.routingkey"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment