File tree Expand file tree Collapse file tree 3 files changed +10
-13
lines changed Expand file tree Collapse file tree 3 files changed +10
-13
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,6 @@ module example
3
3
go 1.16
4
4
5
5
require (
6
- github.com/golang-queue/nsq v0.0.2 -0.20210822032808-c373e18f518d
7
- github.com/golang-queue/queue v0.0.7
6
+ github.com/golang-queue/nsq v0.0.3 -0.20210905090550-9244a526d0b7
7
+ github.com/golang-queue/queue v0.0.8-0.20210905095503-cc99dff8fdc3
8
8
)
Original file line number Diff line number Diff line change @@ -2,8 +2,13 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8
2
2
github.com/davecgh/go-spew v1.1.0 /go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38 =
3
3
github.com/golang-queue/nsq v0.0.2-0.20210822032808-c373e18f518d h1:xehJNG7VCLtO8R++fkgfCm/cMlxiYZwVsKY4CJwINmE =
4
4
github.com/golang-queue/nsq v0.0.2-0.20210822032808-c373e18f518d /go.mod h1:1Q/8y4BclWLj03sn0dApJIObatC3qMX5gLjlbo0TwXs =
5
+ github.com/golang-queue/nsq v0.0.3-0.20210905090550-9244a526d0b7 h1:lMHAkoYeCPLp4o8uM+GQ6ijr/opJRWorDK7M7caI/3k =
6
+ github.com/golang-queue/nsq v0.0.3-0.20210905090550-9244a526d0b7 /go.mod h1:I2JzRTV5lLsgu/R6c4SXjPt8ZhyX/lsV8bhjTZP9yu0 =
5
7
github.com/golang-queue/queue v0.0.7 h1:WENCPyPBcIWYgBFSAZ8USGtwmxeCeMkhjwuyM0MAi84 =
6
8
github.com/golang-queue/queue v0.0.7 /go.mod h1:JS5tYJacahCjafcplU5idNLX2vkYioqh6wEDX5o9Nms =
9
+ github.com/golang-queue/queue v0.0.8-0.20210905085819-3cd1dfe014e2 /go.mod h1:JS5tYJacahCjafcplU5idNLX2vkYioqh6wEDX5o9Nms =
10
+ github.com/golang-queue/queue v0.0.8-0.20210905095503-cc99dff8fdc3 h1:ka4/BRgVndDi92gaeOpjnnfuUXrWr1y87x/Go9M3x3Y =
11
+ github.com/golang-queue/queue v0.0.8-0.20210905095503-cc99dff8fdc3 /go.mod h1:JS5tYJacahCjafcplU5idNLX2vkYioqh6wEDX5o9Nms =
7
12
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4 =
8
13
github.com/golang/snappy v0.0.1 /go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q =
9
14
github.com/nsqio/go-nsq v1.0.8 h1:3L2F8tNLlwXXlp2slDUrUWSBn2O3nMh8R1/KEDFTHPk =
Original file line number Diff line number Diff line change 4
4
"context"
5
5
"encoding/json"
6
6
"fmt"
7
- "log"
8
7
"time"
9
8
10
9
"github.com/golang-queue/nsq"
@@ -48,13 +47,11 @@ func main() {
48
47
)
49
48
50
49
// define the queue
51
- q , err := queue .NewQueue (
52
- queue . WithWorkerCount ( 10 ) ,
50
+ q := queue .NewPool (
51
+ 10 ,
53
52
queue .WithWorker (w ),
54
53
)
55
- if err != nil {
56
- log .Fatal (err )
57
- }
54
+ defer q .Release ()
58
55
59
56
// start the five worker
60
57
q .Start ()
@@ -73,9 +70,4 @@ func main() {
73
70
fmt .Println ("message:" , <- rets )
74
71
time .Sleep (50 * time .Millisecond )
75
72
}
76
-
77
- // shutdown the service and notify all the worker
78
- q .Shutdown ()
79
- // wait all jobs are complete.
80
- q .Wait ()
81
73
}
You can’t perform that action at this time.
0 commit comments