add AutoAck support for Server

This commit is contained in:
shu xian
2019-05-24 20:06:27 +08:00
parent 0a3df1b2f3
commit fac42bc1a9
3 changed files with 22 additions and 1 deletions

View File

@@ -365,9 +365,15 @@ func (s *rpcServer) Register() error {
if queue := sb.Options().Queue; len(queue) > 0 {
opts = append(opts, broker.Queue(queue))
}
if cx := sb.Options().Context; cx != nil {
opts = append(opts, broker.SubscribeContext(cx))
}
if !sb.Options().AutoAck {
opts = append(opts, broker.DisableAutoAck())
}
sub, err := config.Broker.Subscribe(sb.Topic(), handler, opts...)
if err != nil {
return err