-
Notifications
You must be signed in to change notification settings - Fork 0
/
observer.goTestStreamMessageObserver.go
46 lines (35 loc) · 1.24 KB
/
observer.goTestStreamMessageObserver.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package test
import (
"fmt"
"reflect"
nsq "github.com/Bofry/worker-nsq"
"github.com/Bofry/worker-nsq/tracing"
)
var _ nsq.MessageObserver = new(GoTestStreamMessageObserver)
type GoTestStreamMessageObserver struct {
ServiceProvider *ServiceProvider
}
func (*GoTestStreamMessageObserver) Init() {
fmt.Println("GoTestStreamMessageObserver.Init()")
}
// OnFinish implements internal.MessageObserver.
func (o *GoTestStreamMessageObserver) OnFinish(ctx *nsq.Context, message *nsq.Message) {
tr := tracing.GetTracer(o)
sp := tr.Start(ctx, "OnFinish()")
defer sp.End()
o.ServiceProvider.Logger().Println("GoTestStreamMessageObserver.OnFinish()")
}
// OnRequeue implements internal.MessageObserver.
func (o *GoTestStreamMessageObserver) OnRequeue(ctx *nsq.Context, message *nsq.Message) {
tr := tracing.GetTracer(o)
sp := tr.Start(ctx, "OnRequeue()")
defer sp.End()
o.ServiceProvider.Logger().Println("GoTestStreamMessageObserver.OnRequeue()")
}
// OnTouch implements internal.MessageObserver.
func (o *GoTestStreamMessageObserver) OnTouch(ctx *nsq.Context, message *nsq.Message) {
o.ServiceProvider.Logger().Println("GoTestStreamMessageObserver.OnTouch()")
}
func (o *GoTestStreamMessageObserver) Type() reflect.Type {
return reflect.TypeOf(o)
}