blob: 5604a574f7285d7e8eb5aa8791c92d64180c584a (
plain)
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
|
package broadcast
import "golang.org/x/sync/errgroup"
type rpcService struct {
svc *Service
}
// Publish Messages.
func (r *rpcService) Publish(msg []*Message, ok *bool) error {
*ok = true
return r.svc.Publish(msg...)
}
// Publish Messages in async mode. Blocks until get an err or nil from publish
func (r *rpcService) PublishAsync(msg []*Message, ok *bool) error {
*ok = true
g := &errgroup.Group{}
g.Go(func() error {
return r.svc.Publish(msg...)
})
return g.Wait()
}
|