File tree Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 8
8
9
9
"github.com/golang-queue/nsq"
10
10
"github.com/golang-queue/queue"
11
+ "github.com/golang-queue/queue/core"
11
12
)
12
13
13
14
type job struct {
@@ -33,12 +34,13 @@ func main() {
33
34
nsq .WithChannel ("foobar" ),
34
35
// concurrent job number
35
36
nsq .WithMaxInFlight (10 ),
36
- nsq .WithRunFunc (func (ctx context.Context , m queue .QueuedMessage ) error {
37
+ nsq .WithRunFunc (func (ctx context.Context , m core .QueuedMessage ) error {
37
38
var v * job
38
39
if err := json .Unmarshal (m .Bytes (), & v ); err != nil {
39
40
return err
40
41
}
41
42
rets <- v .Message
43
+ time .Sleep (6 * time .Second )
42
44
return nil
43
45
}),
44
46
)
Original file line number Diff line number Diff line change 4
4
5
5
require (
6
6
github.com/golang-queue/nsq v0.0.0-00010101000000-000000000000
7
- github.com/golang-queue/queue v0.0.13-0.20220403053548-d431277d570f
7
+ github.com/golang-queue/queue v0.0.13-0.20220408035349-ed24fa14aa00
8
8
)
9
9
10
10
require (
Original file line number Diff line number Diff line change 1
1
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8 =
2
- github.com/golang-queue/queue v0.0.13-0.20220403053548-d431277d570f h1:Wioq3g97ssizNPQsPwdL61DIjePabPaq+XYo7z2t2Oc =
3
- github.com/golang-queue/queue v0.0.13-0.20220403053548-d431277d570f /go.mod h1:KD9age1s6nk8Evz3tfKHsk8k4LwA0htxQ7MS7rJPJzA =
2
+ github.com/golang-queue/queue v0.0.13-0.20220408035349-ed24fa14aa00 h1:EFiINOvAuGgxiE3MNu7PKY0O2Pvvc7r6YApdqAnhWnQ =
3
+ github.com/golang-queue/queue v0.0.13-0.20220408035349-ed24fa14aa00 /go.mod h1:g1yxxDl8JMo4gUfxt11fjjU3SXU1ah61EvwshmDoSIs =
4
+ github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc =
4
5
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4 =
5
6
github.com/golang/snappy v0.0.1 /go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q =
6
7
github.com/nsqio/go-nsq v1.1.0 h1:PQg+xxiUjA7V+TLdXw7nVrJ5Jbl3sN86EhGCQj4+FYE =
You can’t perform that action at this time.
0 commit comments