1 Star 0 Fork 0

zhangjungang/beats

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
sync.go 992 Bytes
一键复制 编辑 原始数据 按行查看 历史
package publisher
import "github.com/elastic/beats/libbeat/common/op"
type syncPipeline struct {
pub *BeatPublisher
}
func newSyncPipeline(pub *BeatPublisher, hwm, bulkHWM int) *syncPipeline {
return &syncPipeline{pub: pub}
}
func (p *syncPipeline) publish(m message) bool {
if p.pub.disabled {
debug("publisher disabled")
op.SigCompleted(m.context.Signal)
return true
}
client := m.client
signal := m.context.Signal
sync := op.NewSignalChannel()
if len(p.pub.Output) > 1 {
m.context.Signal = op.SplitSignaler(sync, len(p.pub.Output))
} else {
m.context.Signal = sync
}
for _, o := range p.pub.Output {
o.send(m)
}
// Await completion signal from output plugin. If client has been disconnected
// ignore any signal and drop events no matter if send or not.
select {
case <-client.canceler.Done():
return false // return false, indicating events potentially not being send
case sig := <-sync.C:
sig.Apply(signal)
return sig == op.SignalCompleted
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhangjungang/beats.git
git@gitee.com:zhangjungang/beats.git
zhangjungang
beats
beats
v5.4.2

搜索帮助