Closed Dieterbe closed 8 years ago
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
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 throughWriteBulkBytes
and gets appended tob.buf
so that on failed flush, we can include the appropriate id's on theErrorChannel
message, or on success we can write the succeeded id's to aSuccessChannel
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