Configure buffer limit by message count

This allows an operator to decide how large the buffers should be. It
also provides an escape valve to clear the buffer entirely.
Fix counting bug in buffer

Quoting @davisp:

There's a bug in rexi_buffer that can lead to the counter in its state
running negative. I noticed this on malort looking for memory usage. A
quick reading of the code suggests its due to us getting a timeout
message with an empty queue. Theoretically this could happen if we've
exceeded the MAX_MEMORY threshold when sending a message or even with
just grabbing the buffered count when its idle.

BugzID: 28049
Merge pull request #25 from cloudant/28049-rexi-buffer

Counting bugfix and configurability enhancement for buffers

BugzID: 28049