示例#1
0
func Signal(signaler outputs.Signaler) ClientOption {
	return func(ctx context) context {
		if ctx.signal == nil {
			ctx.signal = signaler
		} else {
			ctx.signal = outputs.NewCompositeSignaler(ctx.signal, signaler)
		}
		return ctx
	}
}
示例#2
0
func (b *bulkWorker) publish() {
	// TODO: remember/merge and forward context options to output worker
	b.output.send(message{
		context: context{
			signal: outputs.NewCompositeSignaler(b.pending...),
		},
		events: b.events,
	})

	b.pending = nil
	b.events = make([]common.MapStr, 0, b.maxBatchSize)
}
示例#3
0
文件: bulk.go 项目: jarpy/beats
func (b *bulkWorker) publish() {
	// TODO: remember/merge and forward context options to output worker
	b.output.send(message{
		context: Context{
			publishOptions: publishOptions{Guaranteed: b.guaranteed},
			Signal:         outputs.NewCompositeSignaler(b.pending...),
		},
		event:  nil,
		events: b.events,
	})

	b.ws.AddEvent(-len(b.events))
	b.pending = nil
	b.guaranteed = false
	b.events = make([]common.MapStr, 0, b.maxBatchSize)
}