zhangmeng
2023-05-16 c936044526eff70d73fbefa3c53963d4cfb2a5c0
for go get
6个文件已删除
11 文件已重命名
1个文件已修改
355 ■■■■ 已修改文件
README.md 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
channel.go 补丁 | 查看 | 原始文档 | blame | 历史
cmd/TST/ctest/ctest.cpp 补丁 | 查看 | 原始文档 | blame | 历史
cmd/TST/test/test.go 补丁 | 查看 | 原始文档 | blame | 历史
cmd/clib/libnsqclient.h 补丁 | 查看 | 原始文档 | blame | 历史
cmd/main.go 补丁 | 查看 | 原始文档 | blame | 历史
cmd/make.sh 补丁 | 查看 | 原始文档 | blame | 历史
conn.go 补丁 | 查看 | 原始文档 | blame | 历史
consumer.go 补丁 | 查看 | 原始文档 | blame | 历史
go.mod 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
go.sum 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gonsqcli 补丁 | 查看 | 原始文档 | blame | 历史
nsqclient/LICENSE 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
nsqclient/README.md 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
nsqclient/channel_test.go 218 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pointer.go 补丁 | 查看 | 原始文档 | blame | 历史
pool.go 补丁 | 查看 | 原始文档 | blame | 历史
producer.go 补丁 | 查看 | 原始文档 | blame | 历史
README.md
@@ -1,4 +1,54 @@
## nsqclient
# NSQPool
nsq client
NSQPool is a thread safe connection pool for nsq producer. It can be used to
manage and reuse nsq producer connection.
## Install and Usage
Install the package with:
```bash
github.com/qgymje/nsqpool
```
Import it with:
```go
import (
    "github.com/qgymje/nsqpool"
    nsq "github.com/nsqio/go-nsq"
)
```
and use `pool` as the package name inside the code.
## Example
```go
// create a factory() to be used with channel based pool
factory := func() (*nsq.Producer, error) {
    config := nsq.NewConfig()
    return nsq.NewProducer(":4150", config)
}
nsqPool, err := pool.NewChannelPool(5, 30, factory)
producer, err := nsqPool.Get()
producer.Publish("topic", "some data")
// do something with producer and put it back to the pool by closing the connection
// (this doesn't close the underlying connection instead it's putting it back
// to the pool).
producer.Close()
// close pool any time you want, this closes all the connections inside a pool
nsqPool.Close()
// currently available connections in the pool
current := nsqPool.Len()
```
## License
The MIT License (MIT) - see LICENSE for more details
channel.go
cmd/TST/ctest/ctest.cpp
cmd/TST/test/test.go
cmd/clib/libnsqclient.h
cmd/main.go
cmd/make.sh
conn.go
consumer.go
go.mod
File was deleted
go.sum
File was deleted
gonsqcli
Binary files differ
nsqclient/LICENSE
File was deleted
nsqclient/README.md
File was deleted
nsqclient/channel_test.go
File was deleted
pointer.go
pool.go
producer.go