@@ -36,31 +36,22 @@ var defaultSubscription = &common.Subscription{
36
36
}
37
37
38
38
var bulkSubscription = & common.Subscription {
39
- PubsubName : "bulkmessages " ,
39
+ PubsubName : "messages " ,
40
40
Topic : "newbulkorder" ,
41
41
Route : "/bulkorders" ,
42
42
}
43
43
44
- var importantSubscription = & common.Subscription {
45
- PubsubName : "messages" ,
46
- Topic : "neworder" ,
47
- Route : "/important" ,
48
- Match : `event.type == "important"` ,
49
- Priority : 1 ,
50
- }
51
-
52
44
func main () {
53
45
s := daprd .NewService (":8080" )
54
46
55
- // use this for bulk subscription
56
- // if err := s.AddBulkTopicEventHandler(defaultSubscription, eventHandler, 10, 100); err != nil {
57
- // log.Fatalf("error adding topic subscription: %v", err)
58
- // }
59
-
60
47
if err := s .AddTopicEventHandler (defaultSubscription , eventHandler ); err != nil {
61
48
log .Fatalf ("error adding topic subscription: %v" , err )
62
49
}
63
50
51
+ if err := s .AddBulkTopicEventHandler (bulkSubscription , eventHandler , 10 , 100 ); err != nil {
52
+ log .Fatalf ("error adding topic subscription: %v" , err )
53
+ }
54
+
64
55
if err := s .Start (); err != nil && err != http .ErrServerClosed {
65
56
log .Fatalf ("error listenning: %v" , err )
66
57
}
@@ -70,8 +61,3 @@ func eventHandler(ctx context.Context, e *common.TopicEvent) (retry bool, err er
70
61
log .Printf ("event - PubsubName: %s, Topic: %s, ID: %s, Data: %s" , e .PubsubName , e .Topic , e .ID , e .Data )
71
62
return false , nil
72
63
}
73
-
74
- func importantEventHandler (ctx context.Context , e * common.TopicEvent ) (retry bool , err error ) {
75
- log .Printf ("important event - PubsubName: %s, Topic: %s, ID: %s, Data: %s" , e .PubsubName , e .Topic , e .ID , e .Data )
76
- return false , nil
77
- }
0 commit comments