wait for subscribers to complete

This commit is contained in:
Asim Aslam 2017-05-31 19:47:41 +01:00
parent 2ee22f5336
commit f7a9207c7a

View File

@ -226,11 +226,15 @@ func (s *rpcServer) createSubHandler(sb *subscriber, opts Options) broker.Handle
fn = opts.SubWrappers[i-1](fn)
}
go fn(ctx, &rpcPublication{
topic: sb.topic,
contentType: ct,
message: req.Interface(),
})
s.wg.Add(1)
go func() {
fn(ctx, &rpcPublication{
topic: sb.topic,
contentType: ct,
message: req.Interface(),
})
s.wg.Done()
}()
}
return nil
}