Topic messages API. Contract

This commit is contained in:
Anton Petrov 2020-05-12 19:02:55 +03:00
parent 5b4a9c5a03
commit 7813c5e5ab
2 changed files with 67 additions and 1 deletions

View file

@ -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<ResponseEntity<Flux<TopicMessage>>> getTopicMessages(String clusterName, String topicName, @Valid Integer partition, @Valid Long offset, @Valid OffsetDateTime timestamp, ServerWebExchange exchange) {
return Mono.error(new UnsupportedOperationException());
}
@Override
public Mono<ResponseEntity<Topic>> createTopic(String clusterName, @Valid Mono<TopicFormData> topicFormData, ServerWebExchange exchange) {
return clusterService.createTopic(clusterName, topicFormData)

View file

@ -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:
@ -336,3 +377,21 @@ components:
type: integer
numTopics:
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