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) fn = opts.SubWrappers[i-1](fn)
} }
go fn(ctx, &rpcPublication{ s.wg.Add(1)
topic: sb.topic, go func() {
contentType: ct, fn(ctx, &rpcPublication{
message: req.Interface(), topic: sb.topic,
}) contentType: ct,
message: req.Interface(),
})
s.wg.Done()
}()
} }
return nil return nil
} }