refactor names

This commit is contained in:
kevin
2020-08-16 23:07:21 +08:00
parent 4bdf5e4c90
commit 4b636cd293
4 changed files with 13 additions and 13 deletions

31
core/queue/multipusher.go Normal file
View File

@@ -0,0 +1,31 @@
package queue
import "github.com/tal-tech/go-zero/core/errorx"
type MultiPusher struct {
name string
pushers []Pusher
}
func NewMultiPusher(pushers []Pusher) Pusher {
return &MultiPusher{
name: generateName(pushers),
pushers: pushers,
}
}
func (pusher *MultiPusher) Name() string {
return pusher.name
}
func (pusher *MultiPusher) Push(message string) error {
var batchError errorx.BatchError
for _, each := range pusher.pushers {
if err := each.Push(message); err != nil {
batchError.Add(err)
}
}
return batchError.Err()
}