-
-
Notifications
You must be signed in to change notification settings - Fork 290
/
Copy pathadeo-kafka-request-reply-asyncapi.yml
298 lines (294 loc) · 10.1 KB
/
adeo-kafka-request-reply-asyncapi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
asyncapi: 3.0.0
info:
title: Adeo AsyncAPI Case Study
version: '%REPLACED_BY_MAVEN%'
description: >
This Adeo specification illustrates how ADEO uses AsyncAPI to document some
of their exchanges.
contact:
name: AsyncAPI Community
email: case-study@asyncapi.com
tags:
- name: costing
description: Costing channels, used by Costing clients.
servers:
production:
host: prod.url:9092
protocol: kafka
description: Kafka PRODUCTION cluster
security:
- $ref: '#/components/securitySchemes/sasl-ssl'
bindings:
kafka:
schemaRegistryUrl: https://schema-registry.prod.url/
staging:
host: staging.url:9092
protocol: kafka
description: Kafka STAGING cluster for `uat` and `preprod` environments
security:
- $ref: '#/components/securitySchemes/sasl-ssl'
bindings:
kafka:
schemaRegistryUrl: https://schema-registry.prod.url/
dev:
host: dev.url:9092
protocol: kafka
description: Kafka DEV cluster for `dev` and `sit` environments
security:
- $ref: '#/components/securitySchemes/sasl-ssl'
bindings:
kafka:
schemaRegistryUrl: https://schema-registry.prod.url/
channels:
costingRequestChannel:
address: adeo-{env}-case-study-COSTING-REQUEST-{version}
description: >
Use this topic to do a Costing Request to Costing product. We use the
[**RecordNameStrategy**](https://docs.confluent.io/platform/current/schema-registry/serdes-develop/index.html#subject-name-strategy)
to infer the messages schema. You have to define
`value.subject.name.strategy` to
`io.confluent.kafka.serializers.subject.RecordNameStrategy` in your
producer to use the schema we manage. The schema below illustrates how
Costing Request messages are handled.

parameters:
env:
$ref: '#/components/parameters/Env'
version:
$ref: '#/components/parameters/Version'
bindings:
kafka:
replicas: 3
partitions: 3
topicConfiguration:
cleanup.policy:
- delete
retention.ms: 60000000
messages:
CostingRequest:
$ref: '#/components/messages/costingRequestV1'
costingResponseChannel:
address: null
description: >
This topic is used to REPLY Costing Requests and is targeted by the
`REPLY_TOPIC` header. **You must grant PUBLISH access to our `svc-ccr-app`
service account.**. We use the
[**RecordNameStrategy**](https://docs.confluent.io/platform/current/schema-registry/serdes-develop/index.html#subject-name-strategy)
to infer the messages schema.
Topic should follow pattern "adeo-{env}-case-study-COSTING-RESPONSE-{version}"
You have to define
`key.subject.name.strategy` and `value.subject.name.strategy` to
`io.confluent.kafka.serializers.subject.RecordNameStrategy` in your
consumer. The schema below illustrates how Costing Response messages are
handled.

bindings:
kafka:
x-key.subject.name.strategy:
type: string
description: >
We use the RecordNameStrategy to infer the messages schema. Use
`key.subject.name.strategy=io.confluent.kafka.serializers.subject.RecordNameStrategy`
in your consumer configuration.
x-value.subject.name.strategy:
type: string
description: >
We use the RecordNameStrategy to infer the messages schema. Use
`value.subject.name.strategy=io.confluent.kafka.serializers.subject.RecordNameStrategy`
in your consumer configuration.
tags:
- name: costing
messages:
costingResponse:
$ref: '#/components/messages/costingResponse'
operations:
receiveACostingRequest:
action: receive
channel:
$ref: '#/channels/costingRequestChannel'
reply:
channel:
$ref: '#/channels/costingResponseChannel'
address:
location: $message.header#/REPLY_TOPIC
summary: |
[COSTING] Request one or more Costing calculation for any product
description: >
You can try a costing request using our [Conduktor producer
template](https://conduktor.url/)
tags:
- name: costing
bindings:
kafka:
groupId:
type: string
description: >
The groupId must be prefixed by your `svc` account, deliver by the
Adeo Kafka team. This `svc` must have the write access to the topic.
x-value.subject.name.strategy:
type: string
description: >
We use the RecordNameStrategy to infer the messages schema. Use
`value.subject.name.strategy=io.confluent.kafka.serializers.subject.RecordNameStrategy`
in your producer configuration.
components:
correlationIds:
costingCorrelationId:
description: >
This correlation ID is used for message tracing and messages
correlation. This correlation ID is generated at runtime based on the
`REQUEST_ID` and sent to the RESPONSE message.
location: $message.header#/REQUEST_ID
messages:
costingRequestV1:
name: CostingRequestV1
title: Costing Request V1
summary: Costing Request V1 inputs.
tags:
- name: costing
correlationId:
$ref: '#/components/correlationIds/costingCorrelationId'
headers:
type: object
required:
- REQUESTER_ID
- REQUESTER_CODE
- REQUEST_ID
- REPLY_TOPIC
properties:
REQUEST_ID:
$ref: '#/components/schemas/RequestId'
REPLY_TOPIC:
$ref: '#/components/schemas/ReplyTopic'
REQUESTER_ID:
$ref: '#/components/schemas/RequesterId'
REQUESTER_CODE:
$ref: '#/components/schemas/RequesterCode'
payload:
schemaFormat: application/vnd.apache.avro;version=1.9.0
schema:
$ref: https://www.asyncapi.com/resources/casestudies/adeo/CostingRequestPayload.avsc
costingResponse:
name: CostingResponse
title: Costing Response
summary: Costing Response ouputs.
tags:
- name: costing
description: >
Please refer to the `CostingResponseKey.avsc` schema, available on [our
github project](https://github.url/).
correlationId:
$ref: '#/components/correlationIds/costingCorrelationId'
headers:
type: object
properties:
CALCULATION_ID:
$ref: '#/components/schemas/MessageId'
CORRELATION_ID:
$ref: '#/components/schemas/CorrelationId'
REQUEST_TIMESTAMP:
type: string
format: date-time
description: Timestamp of the costing request
CALCULATION_TIMESTAMP:
type: string
format: date-time
description: Technical timestamp for the costing calculation
payload:
schemaFormat: application/vnd.apache.avro;version=1.9.0
schema:
$ref: https://www.asyncapi.com/resources/casestudies/adeo/CostingResponsePayload.avsc
schemas:
RequesterId:
type: string
description: The Costing requester service account used to produce costing request.
examples:
- svc-ecollect-app
RequesterCode:
type: string
description: >-
The Costing requester code (generally the BU Code). The requester code
is useful to get the dedicated context (tenant).
examples:
- 1
MessageId:
type: string
format: uuid
description: A unique Message ID.
examples:
- 1fa6ef40-8f47-40a8-8cf6-f8607d0066ef
RequestId:
type: string
format: uuid
description: >-
A unique Request ID needed to define a `CORRELATION_ID` for exchanges,
which will be sent back in the Costing Responses.
examples:
- 1fa6ef40-8f47-40a8-8cf6-f8607d0066ef
CorrelationId:
type: string
format: uuid
description: >-
A unique Correlation ID defined from the `REQUEST_ID` or the
`MESSAGE_ID` provided in the Costing Request.
examples:
- 1fa6ef40-8f47-40a8-8cf6-f8607d0066ef
BuCode:
type: string
description: The Business Unit code for which data are applicable.
examples:
- 1
ReplyTopic:
type: string
description: >
The Kafka topic where to send the Costing Response. This is required for
the [Return Address EIP
pattern](https://www.enterpriseintegrationpatterns.com/patterns/messaging/ReturnAddress.html).
**You must grant WRITE access to our `svc-ccr-app` service account.**
examples:
- adeo-case-study-COSTING-RESPONSE-V1
ErrorStep:
type: string
description: |
The woker that has thrown the error.
examples:
- EXPOSE_RESULT
ErrorMessage:
type: string
description: |
The error message describing the error.
examples:
- Error message
ErrorCode:
type: string
description: |
The error code.
examples:
- CURRENCY_NOT_FOUND
parameters:
Env:
description: Adeo Kafka Environement for messages publications.
enum:
- dev
- sit
- uat1
- preprod
- prod
Version:
description: the topic version you want to use
examples:
- V1
default: V1
securitySchemes:
sasl-ssl:
type: plain
x-sasl.jaas.config: >-
org.apache.kafka.common.security.plain.PlainLoginModule required
username="<CLUSTER_API_KEY>" password="<CLUSTER_API_SECRET>";
x-security.protocol: SASL_SSL
x-ssl.endpoint.identification.algorithm: https
x-sasl.mechanism: PLAIN
description: >
Use [SASL authentication with SSL
encryption](https://docs.confluent.io/platform/current/security/security_tutorial.html#configure-clients)
to connect to the ADEO Broker.