Uploaded image for project: 'Flume'
  1. Flume
  2. FLUME-978

Context interface is too basic requiring boilerplate user code

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.0.0
    • 1.1.0
    • None
    • None

    Description

      Flume is filled with examples like so:

      batchSize = Integer.parseInt(context.get("batch-size", String.class));
      if (batchSize == null) {
      batchSize = defaultBatchSize;
      }

      from AvroSink. The Context object should provide at a minimum:

      • getBoolean(key)
      • getBoolean(key, default)
      • getInteger(key)
      • getInteger(key, default)
      • getLong(key)
      • getLong(key, default)

      Additionally, the Context object outside of tests, is populated via FlumeConfiguration which in the end is a properties file. In this common case, all the values in the Context object will be Strings. In this case, if we do the obvious and simply provide wrappers for getBoolean, we end up executing:

      return Boolean.class.cast(String);

      Users of the Context object should not care where the values come from, only that they will be returned the correct object type.

      Attachments

        1. FLUME-978-2.patch
          29 kB
          Brock Noland
        2. FLUME-978-1.patch
          29 kB
          Brock Noland
        3. FLUME-978-0.patch
          23 kB
          Brock Noland

        Activity

          People

            brocknoland Brock Noland
            brocknoland Brock Noland
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: