Expose method to send multiple messages at once
wsorenson opened this issue · 3 comments
message:
[tag, time, record]
or
[tag, [[time,record], [time,record], ...]]
For bulk writing, could we have a way to send the second?
There is no way to send multiple messages at once for now.
I think you want an API like this:
public class FluentLogger {
public class Record {
private final long timestamp;
private final String key;
private final Object val;
public Record(long timestamp, String key, Object val) {
this.timestamp = timestamp;
this.key = key;
this.val = val;
}
}
public boolean multiLog(String tag, List<Record> records) {
:
}
I think this kind of multi sending has a difficulty related to error handling.
Let's consider the following case:
- you multi-send 100 records at once
- 20 records is sent well
- the connection between the Fluentd and logger gets wrong
- the logger buffers next 40 records in the memory
- the buffer gets full
- the logger returns false which means the buffer is full
When you know that the buffer is full , it's difficult to resend the unsent records without any duplication or lost of records for now.
Hmm, could it not combine all records into a single message which either succeeds/fails?
fluentd's in_forward can accept multiple events at once so
this method could be implemented: https://github.com/fluent/fluentd/blob/master/lib/fluent/plugin/in_forward.rb#L104-L113