From 7813c5e5abd6e8918b125a527bc51366efe3d68b Mon Sep 17 00:00:00 2001 From: Anton Petrov Date: Tue, 12 May 2020 19:02:55 +0300 Subject: [PATCH 1/2] Topic messages API. Contract --- .../kafka/ui/rest/MetricsRestController.java | 7 +++ .../main/resources/swagger/kafka-ui-api.yaml | 61 ++++++++++++++++++- 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/kafka-ui-api/src/main/java/com/provectus/kafka/ui/rest/MetricsRestController.java b/kafka-ui-api/src/main/java/com/provectus/kafka/ui/rest/MetricsRestController.java index 82348aa4a1..7e814efd36 100644 --- a/kafka-ui-api/src/main/java/com/provectus/kafka/ui/rest/MetricsRestController.java +++ b/kafka-ui-api/src/main/java/com/provectus/kafka/ui/rest/MetricsRestController.java @@ -11,6 +11,8 @@ import org.springframework.web.server.ServerWebExchange; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import java.time.OffsetDateTime; + import javax.validation.Valid; @RestController @@ -57,6 +59,11 @@ public class MetricsRestController implements ApiClustersApi { ); } + @Override + public Mono>> getTopicMessages(String clusterName, String topicName, @Valid Integer partition, @Valid Long offset, @Valid OffsetDateTime timestamp, ServerWebExchange exchange) { + return Mono.error(new UnsupportedOperationException()); + } + @Override public Mono> createTopic(String clusterName, @Valid Mono topicFormData, ServerWebExchange exchange) { return clusterService.createTopic(clusterName, topicFormData) diff --git a/kafka-ui-contract/src/main/resources/swagger/kafka-ui-api.yaml b/kafka-ui-contract/src/main/resources/swagger/kafka-ui-api.yaml index acb19f1981..7c6e0e4345 100644 --- a/kafka-ui-contract/src/main/resources/swagger/kafka-ui-api.yaml +++ b/kafka-ui-contract/src/main/resources/swagger/kafka-ui-api.yaml @@ -169,6 +169,47 @@ paths: items: $ref: '#/components/schemas/TopicConfig' + /api/clusters/{clusterName}/topics/{topicName}/messages: + get: + tags: + - /api/clusters + summary: getTopicMessages + operationId: getTopicMessages + parameters: + - name: clusterName + in: path + required: true + schema: + type: string + - name: topicName + in: path + required: true + schema: + type: string + - name: partition + in: query + schema: + type: integer + - name: offset + in: query + schema: + type: integer + format: int64 + - name: timestamp + in: query + schema: + type: string + format: date-time + responses: + 200: + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/TopicMessage' + /api/clusters/{clusterName}/consumerGroups: get: tags: @@ -335,4 +376,22 @@ components: numConsumers: type: integer numTopics: - type: integer \ No newline at end of file + type: integer + + TopicMessage: + type: object + properties: + partition: + type: integer + offset: + type: integer + format: int64 + timestamp: + type: string + format: date-time + content: + type: string + required: + - partition + - offset + - timestamp \ No newline at end of file From c725927261d414ba8e7741aa99de75e4825b3665 Mon Sep 17 00:00:00 2001 From: Anton Petrov Date: Wed, 13 May 2020 17:28:27 +0300 Subject: [PATCH 2/2] Add key, headers and timestamp type fields --- .../src/main/resources/swagger/kafka-ui-api.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/kafka-ui-contract/src/main/resources/swagger/kafka-ui-api.yaml b/kafka-ui-contract/src/main/resources/swagger/kafka-ui-api.yaml index 7c6e0e4345..a46ccfbe8e 100644 --- a/kafka-ui-contract/src/main/resources/swagger/kafka-ui-api.yaml +++ b/kafka-ui-contract/src/main/resources/swagger/kafka-ui-api.yaml @@ -389,6 +389,18 @@ components: timestamp: type: string format: date-time + timestampType: + type: string + enum: + - NO_TIMESTAMP_TYPE + - CREATE_TIME + - LOG_APPEND_TIME + key: + type: string + headers: + type: object + additionalProperties: + type: string content: type: string required: