File tree Expand file tree Collapse file tree 3 files changed +28
-3
lines changed
springwolf-examples/springwolf-kafka-example/src
main/java/io/github/stavshamir/springwolf/example Expand file tree Collapse file tree 3 files changed +28
-3
lines changed Original file line number Diff line number Diff line change 3
3
import io .github .stavshamir .springwolf .asyncapi .scanners .channels .operationdata .annotation .AsyncOperation ;
4
4
import io .github .stavshamir .springwolf .asyncapi .scanners .channels .operationdata .annotation .AsyncListener ;
5
5
import io .github .stavshamir .springwolf .asyncapi .scanners .channels .operationdata .annotation .KafkaAsyncOperationBinding ;
6
+ import io .github .stavshamir .springwolf .asyncapi .scanners .channels .operationdata .annotation .KafkaAsyncOperationBinding .KafkaAsyncMessageBinding ;
6
7
import io .github .stavshamir .springwolf .example .dtos .AnotherPayloadDto ;
7
8
import io .github .stavshamir .springwolf .example .dtos .ExamplePayloadDto ;
8
9
import org .slf4j .Logger ;
13
14
14
15
import javax .money .MonetaryAmount ;
15
16
17
+ import static io .github .stavshamir .springwolf .asyncapi .scanners .channels .operationdata .annotation .KafkaAsyncOperationBinding .KafkaAsyncMessageBinding .KafkaKeyTypes .STRING_KEY ;
16
18
import static org .springframework .kafka .support .converter .AbstractJavaTypeMapper .DEFAULT_CLASSID_FIELD_NAME ;
17
19
18
20
@@ -50,7 +52,12 @@ public void receiveAnotherPayload(AnotherPayloadDto payload) {
50
52
@ KafkaAsyncOperationBinding (
51
53
bindingVersion = "1" ,
52
54
clientId = "foo-clientId" ,
53
- groupId = "#{'foo-groupId'}"
55
+ groupId = "#{'foo-groupId'}" ,
56
+ messageBinding = @ KafkaAsyncMessageBinding (
57
+ keyType = STRING_KEY ,
58
+ bindingVersion = "1" ,
59
+ description = "Kafka Consumer Message Key"
60
+ )
54
61
)
55
62
public void receiveMonetaryAmount (MonetaryAmount payload ) {
56
63
logger .info ("Received new message in multi-payload-topic: {}" , payload .toString ());
Original file line number Diff line number Diff line change 3
3
import io .github .stavshamir .springwolf .asyncapi .scanners .channels .operationdata .annotation .AsyncOperation ;
4
4
import io .github .stavshamir .springwolf .asyncapi .scanners .channels .operationdata .annotation .AsyncPublisher ;
5
5
import io .github .stavshamir .springwolf .asyncapi .scanners .channels .operationdata .annotation .KafkaAsyncOperationBinding ;
6
+ import io .github .stavshamir .springwolf .asyncapi .scanners .channels .operationdata .annotation .KafkaAsyncOperationBinding .KafkaAsyncMessageBinding ;
6
7
import io .github .stavshamir .springwolf .example .dtos .ExamplePayloadDto ;
7
8
import org .springframework .beans .factory .annotation .Autowired ;
8
9
import org .springframework .kafka .core .KafkaTemplate ;
9
10
import org .springframework .stereotype .Component ;
10
11
12
+ import static io .github .stavshamir .springwolf .asyncapi .scanners .channels .operationdata .annotation .KafkaAsyncOperationBinding .KafkaAsyncMessageBinding .KafkaKeyTypes .STRING_KEY ;
11
13
import static io .github .stavshamir .springwolf .example .configuration .KafkaConfiguration .PRODUCER_TOPIC ;
12
14
import static org .springframework .kafka .support .converter .AbstractJavaTypeMapper .DEFAULT_CLASSID_FIELD_NAME ;
13
15
@@ -38,7 +40,12 @@ public class ExampleProducer {
38
40
))
39
41
@ KafkaAsyncOperationBinding (
40
42
bindingVersion = "1" ,
41
- clientId = "foo-clientId"
43
+ clientId = "foo-clientId" ,
44
+ messageBinding = @ KafkaAsyncMessageBinding (
45
+ keyType = STRING_KEY ,
46
+ bindingVersion = "1" ,
47
+ description = "Kafka Producer Message Key"
48
+ )
42
49
)
43
50
public void sendMessage (ExamplePayloadDto msg ) {
44
51
kafkaTemplate .send (PRODUCER_TOPIC , msg );
Original file line number Diff line number Diff line change 167
167
},
168
168
"headers" : {
169
169
"$ref" : " #/components/schemas/SpringKafkaDefaultHeaders-MonetaryAmount"
170
+ },
171
+ "bindings" : {
172
+ "kafka" : {
173
+ "key" : {
174
+ "type" : " string" ,
175
+ "description" : " Kafka Consumer Message Key" ,
176
+ "exampleSetFlag" : false ,
177
+ "types" : [ " string" ]
178
+ },
179
+ "bindingVersion" : " 1"
180
+ }
170
181
}
171
182
} ]
172
183
}
414
425
}
415
426
},
416
427
"tags" : [ ]
417
- }
428
+ }
You can’t perform that action at this time.
0 commit comments