@@ -36,31 +36,22 @@ var defaultSubscription = &common.Subscription{
3636}
3737
3838var  bulkSubscription  =  & common.Subscription {
39- 	PubsubName : "bulkmessages " ,
39+ 	PubsubName : "messages " ,
4040	Topic :      "newbulkorder" ,
4141	Route :      "/bulkorders" ,
4242}
4343
44- var  importantSubscription  =  & common.Subscription {
45- 	PubsubName : "messages" ,
46- 	Topic :      "neworder" ,
47- 	Route :      "/important" ,
48- 	Match :      `event.type == "important"` ,
49- 	Priority :   1 ,
50- }
51- 
5244func  main () {
5345	s  :=  daprd .NewService (":8080" )
5446
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- 
6047	if  err  :=  s .AddTopicEventHandler (defaultSubscription , eventHandler ); err  !=  nil  {
6148		log .Fatalf ("error adding topic subscription: %v" , err )
6249	}
6350
51+ 	if  err  :=  s .AddBulkTopicEventHandler (bulkSubscription , eventHandler , 10 , 100 ); err  !=  nil  {
52+ 		log .Fatalf ("error adding topic subscription: %v" , err )
53+ 	}
54+ 
6455	if  err  :=  s .Start (); err  !=  nil  &&  err  !=  http .ErrServerClosed  {
6556		log .Fatalf ("error listenning: %v" , err )
6657	}
@@ -70,8 +61,3 @@ func eventHandler(ctx context.Context, e *common.TopicEvent) (retry bool, err er
7061	log .Printf ("event - PubsubName: %s, Topic: %s, ID: %s, Data: %s" , e .PubsubName , e .Topic , e .ID , e .Data )
7162	return  false , nil 
7263}
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