WIP
[demos/kafka/training] / src / main / java / de / juplo / kafka / DriverController.java
index 5a09c1b..fdae76f 100644 (file)
@@ -5,6 +5,7 @@ import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ExecutionException;
 
@@ -14,7 +15,7 @@ import java.util.concurrent.ExecutionException;
 public class DriverController
 {
   private final EndlessConsumer consumer;
-  private final SumRecordHandler wordcount;
+  private final SumRecordHandler sumRecordHandler;
 
 
   @PostMapping("start")
@@ -31,19 +32,19 @@ public class DriverController
 
 
   @GetMapping("seen")
-  public Map<Integer, Map<String, Map<String, Long>>> seen()
+  public Map<Integer, Map<String, List<Long>>> seen()
   {
-    return wordcount.getSeen();
+    return sumRecordHandler.getSeen();
   }
 
   @GetMapping("seen/{user}")
-  public ResponseEntity<Map<String, Long>> seen(@PathVariable String user)
+  public ResponseEntity<List<Long>> seen(@PathVariable String user)
   {
-    for (Map<String, Map<String, Long>> users : wordcount.getSeen().values())
+    for (Map<String, List<Long>> users : sumRecordHandler.getSeen().values())
     {
-      Map<String, Long> words = users.get(user);
-      if (words != null)
-        return ResponseEntity.ok(words);
+      List<Long> results = users.get(user);
+      if (results != null)
+        return ResponseEntity.ok(results);
     }
 
     return ResponseEntity.notFound().build();