Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xgd16/gf-x-rabbitMQ
GF 的 rabbit MQ 接入
https://github.com/xgd16/gf-x-rabbitMQ
Last synced: about 1 month ago
JSON representation
GF 的 rabbit MQ 接入
- Host: GitHub
- URL: https://github.com/xgd16/gf-x-rabbitMQ
- Owner: xgd16
- License: mit
- Created: 2023-06-27T06:24:31.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-07-05T02:37:34.000Z (over 1 year ago)
- Last Synced: 2024-10-14T09:34:56.075Z (about 2 months ago)
- Language: Go
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-gf - gf-x-rabbitMQ - 快捷接入 rabbitMQ 解决多任务处理 (Libraries and Plugins)
README
# GF 的 rabbit MQ 接入
西安豆芽科技有限公司 **制**### GITHUB [gf-x-rabbitMQ](https://github.com/xgd16/gf-x-rabbitMQ)
```go
package mainimport (
"github.com/xgd16/gf-x-rabbitMQ/rabbitMQ"
"github.com/xgd16/gf-x-rabbitMQ/types"
)func main() {
// 发送队列
// param1 队列名称
// param2 参数
// param3 是否持久化数据 (会降低QPS)
rabbitMQ.SendQueue("TestQueue", g.Map{"a":1}, false)
// 监听处理
rabbitMQ.QueueService(map[string]error{
"测试队列": rabbitMQ.CreateConsumerHandler(&types.RegisterHandler[types.TestQueueData]{
Handler: handlers.TestQueue, // 执行的函数
TaskName: "TestQueue", // 订阅的任务名称
SyncNum: 30, // 同时运行的携程数
FieldNames: []string{"age"}, // 基于哪些字段进行单线程限制
}),
})
}
```