Exemplo n.º 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
	}
}
Exemplo n.º 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)
}
Exemplo n.º 3
0
Arquivo: bulk.go Projeto: 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)
}