mattbaird/elastigo

tracking individual messages successes or failures in bulkindexer

Closed this issue · 1 comments

i would like to use the bulkindexer,
but it is important for me to know which messages were successfully bulk-indexed and which were not.

how this could be done is, make func (b *BulkIndexer) Index() also take a message id (which would be like a uint64 or a []byte), keep track of the id's as the data goes through WriteBulkBytes and gets appended to b.buf so that on failed flush, we can include the appropriate id's on the ErrorChannel message, or on success we can write the succeeded id's to a SuccessChannel

that way, as the caller of the bulkindexer i can know if the/which messages were successfully processed or not, so that i can ack the message to my message queue

looks like the nicest solution to this is just set a custom Sender function attribute on the BulkIndexer.
Here's an example of this approach in practice: https://github.com/raintank/raintank-metric/blob/master/eventdef/eventdef.go#L169