Skip to content

Commit 5991d0c

Browse files
authored
docs: Add section for consumer/producer headers
2 parents 2aeb2a3 + ab0d7d2 commit 5991d0c

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

docs/documenting-producers.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public AsyncApiDocket asyncApiDocket() {
2525
.description("Optional. Customer uploaded an example payload")
2626
.operationBinding(ImmutableMap.of("kafka", new KafkaOperationBinding()))
2727
.payloadType(ExamplePayloadDto.class)
28+
.headers(AsyncHeaders.NOT_USED)
2829
.build();
2930

3031
return AsyncApiDocket.builder()
@@ -54,6 +55,13 @@ This property is used to discriminate the producer's protocol and provide protoc
5455

5556
The class object of the payload that will be published to this channel.
5657

58+
### Header
59+
60+
Optional. The headers describing the metadata of the payload.
61+
By default, `AsyncHeaders.NOT_DOCUMENTED` is used to indicate that no explicit header documentation exists.
62+
Use `AsyncHeaders` to add your custom headers, use `AsyncHeaders.NOT_USED` if you do not use headers and `AsyncHeadersForCloudEventsBuilder` if your events follow the CloudEvent specification.
63+
64+
5765
## `AmqpProducerData`
5866

5967
The above Kafka `ProducerData` equivalent in `AmqpProducerData`:
@@ -100,6 +108,7 @@ The above Kafka `ProducerData` simplifies to the following `KafkaProducerData`:
100108
.topicName("example-producer-topic")
101109
.description("Optional. Customer uploaded an example payload")
102110
.payloadType(ExamplePayloadDto.class)
111+
.headers(AsyncHeaders.NOT_USED)
103112
.build();
104113
```
105114

@@ -115,6 +124,12 @@ Optional. The description allows for human-friendly text to verbosely explain th
115124

116125
The class object of the payload that will be published to this channel.
117126

127+
### Headers
128+
129+
The Kafka headers describing the metadata of the payload, more details in the generic ProducerData.
130+
131+
The Springwolf Kafka plugin comes with a special `AsyncHeadersForSpringKafkaBuilder` to document the `__TypeId__` header of the spring-kafka dependency.
132+
118133
### Example
119134

120135
See a full example [here](https://github.com/springwolf/springwolf-core/blob/master/springwolf-examples/springwolf-kafka-example/src/main/java/io/github/stavshamir/springwolf/example/configuration/AsyncApiConfiguration.java).

docs/manually-documenting-consumers.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public AsyncApiDocket asyncApiDocket() {
2525
.description("Optional. Customer uploaded an example payload")
2626
.operationBinding(ImmutableMap.of("kafka", new KafkaOperationBinding()))
2727
.payloadType(ExamplePayloadDto.class)
28+
.headers(AsyncHeaders.NOT_USED)
2829
.build();
2930

3031
return AsyncApiDocket.builder()
@@ -54,6 +55,13 @@ This property is used to discriminate the consumer's protocol and provide protoc
5455

5556
The class object of the payload that will be consumed from this channel.
5657

58+
### Header
59+
60+
Optional. The headers describing the metadata of the payload.
61+
By default, `AsyncHeaders.NOT_DOCUMENTED` is used to indicate that no explicit header documentation exists.
62+
Use `AsyncHeaders` to add your custom headers, use `AsyncHeaders.NOT_USED` if you do not use headers and `AsyncHeadersForCloudEventsBuilder` if your events follow the CloudEvent specification.
63+
64+
5765
## `AmqpConsumerData`
5866

5967
The above Kafka `ConsumerData` equivalent in `AmqpConsumerData`:
@@ -100,6 +108,7 @@ The above Kafka `ConsumerData` simplifies to the following `KafkaConsumerData`:
100108
.topicName("example-consumer-topic")
101109
.description("Optional. Customer uploaded an example payload")
102110
.payloadType(ExamplePayloadDto.class)
111+
.headers(AsyncHeaders.NOT_USED)
103112
.build();
104113
```
105114

@@ -115,6 +124,13 @@ Optional. The description allows for human-friendly text to verbosely explain th
115124

116125
The class object of the payload that will be consumed from this channel.
117126

127+
### Headers
128+
129+
The Kafka headers describing the metadata of the payload, more details in the generic ConsumerData.
130+
131+
The Springwolf Kafka plugin comes with a special `AsyncHeadersForSpringKafkaBuilder` to document the `__TypeId__` header of the spring-kafka dependency.
132+
133+
118134
### Example
119135

120136
See a full example [here](https://github.com/springwolf/springwolf-core/blob/master/springwolf-examples/springwolf-kafka-example/src/main/java/io/github/stavshamir/springwolf/example/configuration/AsyncApiConfiguration.java).

0 commit comments

Comments
 (0)