Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-6018

Make KafkaFuture.Function java 8 lambda compatible

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.1.0
    • Component/s: clients
    • Labels:
      None

      Description

      KafkaFuture.Function is currently an empty public abstract class.

      This means you cannot implement them as a java lambda. And you end up with constructs as:

      new KafkaFuture.Function<Set<String>, Object>() {
          @Override
          public Object apply(Set<String> strings) {
              return foo;
          }
      }
      

      I propose to define them as interfaces.
      So this code can become in java 8:

      strings -> foo
      

      I know this change is backwards incompatible (extends becomes implements).
      But as KafkaFuture is marked as @InterfaceStability.Evolving.
      And KafkaFuture states in its javadoc:

      This will eventually become a thin shim on top of Java 8's CompletableFuture.

      I think this change might be worth considering.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                steven.aerts Steven Aerts
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: