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

Make KafkaFuture.Function java 8 lambda compatible

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.1.0
    • clients
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: