WIP
[demos/kafka/seek] / src / main / java / de / juplo / kafka / seek / SeekController.java
1 package de.juplo.kafka.seek;
2
3 import lombok.RequiredArgsConstructor;
4 import org.springframework.web.bind.annotation.PostMapping;
5 import org.springframework.web.bind.annotation.RequestBody;
6 import org.springframework.web.bind.annotation.RestController;
7
8 import java.util.concurrent.ExecutionException;
9
10
11 @RestController
12 @RequiredArgsConstructor
13 public class SeekController
14 {
15   private final Consumer consumer;
16
17
18   @PostMapping("start")
19   public void start()
20   {
21     consumer.start();
22   }
23
24   @PostMapping("stop")
25   public void stop() throws ExecutionException, InterruptedException
26   {
27     consumer.stop();
28   }
29
30
31   @PostMapping("seek")
32   public void seek(@RequestBody long offset)
33   {
34     consumer.seek(offset);
35   }
36 }