Merge pull request #47 from provectus/feature/10-topic-messages-api-contract

Topic messages API. Contract
This commit is contained in:
Anton Petrov 2020-05-14 12:31:32 +03:00 committed by GitHub
commit a0b4b6e1f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 79 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.Flux;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
import java.time.OffsetDateTime;
import javax.validation.Valid; import javax.validation.Valid;
@RestController @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 @Override
public Mono<ResponseEntity<Topic>> createTopic(String clusterName, @Valid Mono<TopicFormData> topicFormData, ServerWebExchange exchange) { public Mono<ResponseEntity<Topic>> createTopic(String clusterName, @Valid Mono<TopicFormData> topicFormData, ServerWebExchange exchange) {
return clusterService.createTopic(clusterName, topicFormData) return clusterService.createTopic(clusterName, topicFormData)

View file

@ -169,6 +169,47 @@ paths:
items: items:
$ref: '#/components/schemas/TopicConfig' $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: /api/clusters/{clusterName}/consumerGroups:
get: get:
tags: tags:
@ -335,4 +376,34 @@ components:
numConsumers: numConsumers:
type: integer type: integer
numTopics: numTopics:
type: integer type: integer
TopicMessage:
type: object
properties:
partition:
type: integer
offset:
type: integer
format: int64
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:
- partition
- offset
- timestamp