SubscribeExist 订阅已经存在的流
(streamPath string, sub ISubscriber)
| 218 | |
| 219 | // SubscribeExist 订阅已经存在的流 |
| 220 | func (opt *Plugin) SubscribeExist(streamPath string, sub ISubscriber) error { |
| 221 | opt.Info("subscribe exsit", zap.String("path", streamPath)) |
| 222 | path, _, _ := strings.Cut(streamPath, "?") |
| 223 | if !Streams.Has(path) { |
| 224 | opt.Warn("stream not exist", zap.String("path", streamPath)) |
| 225 | return ErrStreamNotExist |
| 226 | } |
| 227 | return opt.Subscribe(streamPath, sub) |
| 228 | } |
| 229 | func (opt *Plugin) AssignSubConfig(suber *Subscriber) { |
| 230 | if suber.Config == nil { |
| 231 | conf, ok := opt.Config.(config.SubscribeConfig) |