Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose method to send multiple messages at once #16

Open
wsorenson opened this issue Apr 18, 2014 · 3 comments
Open

Expose method to send multiple messages at once #16

wsorenson opened this issue Apr 18, 2014 · 3 comments

Comments

@wsorenson
Copy link

message:
[tag, time, record]
or
[tag, [[time,record], [time,record], ...]]

For bulk writing, could we have a way to send the second?

@komamitsu
Copy link
Member

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:

  1. you multi-send 100 records at once
  2. 20 records is sent well
  3. the connection between the Fluentd and logger gets wrong
  4. the logger buffers next 40 records in the memory
  5. the buffer gets full
  6. 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.

@wsorenson
Copy link
Author

Hmm, could it not combine all records into a single message which either succeeds/fails?

@repeatedly
Copy link
Member

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

rmelick pushed a commit to rmelick/fluent-logger-java that referenced this issue Apr 21, 2016
rmelick pushed a commit to rmelick/fluent-logger-java that referenced this issue Apr 21, 2016
komamitsu added a commit that referenced this issue Aug 11, 2016
Reduce error logging if reconnect is disabled (#16).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants