Graylog2/graylog2-server — pull request #111 by mahijames (2013-01-27 22:32:22+00:00)
Title: Add bulk hasCapacity/insert methods to ProcessBuffer

For transports that support queueing and redelivery of batches of messages (i.e. [Facebook Scribe](https://github.com/facebook/scribe/wiki)), it is advantageous to add the message batch to the ProcessBuffer atomically. It is also slightly more efficient to acquire a sequence number for the whole batch in a single operation rather than incrementing the sequence number by one repeatedly.

This means the plugin can fail fast if insufficient capacity is available, and exert backpressure on the transport causing it to queue messages on disk and/or back off (e.g. via Scribe's [TRY_LATER](https://github.com/facebook/scribe/wiki/Logging-Messages) response). Note that Scribe requires the batch of messages to be acknowledged as a whole, so if the batch is partially processed before a failure occurs.

This patch implements this functionality for ProcessBuffer only via a new BatchBuffer interface.