Created
March 13, 2021 14:16
-
-
Save dalelane/bc8e0b07b17b02fff12e1c46c0213ed5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
asyncapi: 2.0.0 | |
# --- | |
id: 'urn:dalelane:stock-level-events' | |
# --- | |
info: | |
title: Stock level events | |
version: 1.1.4 | |
description: |- | |
# Kafka topics available for warehouse events | |
Events for changes to stock levels in each warehouse | |
 | |
Events capture every movement of stock in all warehouses, | |
and this document describes the data that is available. | |
termsOfService: https://stock-systems.com/kafka/tos.html | |
contact: | |
name: Dale Lane | |
email: [email protected] | |
url: https://stock-systems.com/contacts/dalelane.html | |
license: | |
name: Apache 2.0 | |
url: http://www.apache.org/licenses/LICENSE-2.0.html | |
# --- | |
tags: | |
- name: demo | |
description: Sample AsyncAPI specs | |
- name: retail | |
description: Retail themed specs | |
# --- | |
externalDocs: | |
description: Further detail about the stock tracking system | |
url: https://stock-systems.com/documentation.html | |
# --- | |
servers: | |
broker-central: | |
url: 'my-broker-0.fyre.ibm.com:8092' | |
protocol: kafka | |
protocolVersion: '2.6.0' | |
description: Kafka broker running in central warehouse | |
broker-east: | |
url: 'my-broker-1.fyre.ibm.com:8092' | |
protocol: kafka | |
protocolVersion: '2.6.0' | |
description: Kafka broker running in east warehouse | |
broker-west: | |
url: 'my-broker-2.fyre.ibm.com:8092' | |
protocol: kafka | |
protocolVersion: '2.6.0' | |
description: Kafka broker running in west warehouse | |
# --- | |
channels: | |
CENTRAL.WAREHOUSE: | |
description: |- | |
 | |
Events about stock movements in the main central warehouse | |
subscribe: | |
operationId: consumeCentralStockEvent | |
bindings: | |
kafka: | |
clientId: | |
type: string | |
pattern: '^[a-z]{22}$' | |
groupId: | |
type: string | |
pattern: '^[A-Z]{10}[1-5]$' | |
message: | |
name: stockEventCentral | |
title: Central stock event | |
summary: Central warehouse stock change | |
description: Description of a change to the stock level in the **central** warehouse | |
schemaFormat: 'application/vnd.aai.asyncapi;version=2.0.0' | |
contentType: 'application/json' | |
tags: | |
- name: central | |
description: Events relating to the central warehouse | |
- name: stock | |
description: Events relating to stock levels | |
headers: | |
type: object | |
properties: | |
acmeTracking: | |
description: |- | |
If the event was generated by the ACME system, the tracking ID used for | |
correlation purposes will be included in this header. | |
type: string | |
payload: | |
type: object | |
required: | |
- itemid | |
- count | |
- eventtimestamp | |
properties: | |
itemid: | |
description: Catalog id for the item | |
type: string | |
format: uuid | |
type: | |
description: Type of event that led to the stock change | |
type: string | |
default: inter-warehouse-transfer | |
enum: | |
- customer-sale | |
- delivery | |
- inter-warehouse-transfer | |
count: | |
description: Change to the number of items. Positive values indicate increases in stock, negative values indicate decreases in stock level. | |
type: integer | |
eventtimestamp: | |
description: Time that the stock level change was recorded | |
type: string | |
format: date-time | |
signedby: | |
description: Userid of the staff member who approved the transfer. Not required if the transfer was automated | |
type: string | |
format: email | |
additionalProperties: false | |
bindings: | |
kafka: | |
key: | |
type: string | |
enum: | |
- customer-sale | |
- delivery | |
- inter-warehouse-transfer | |
examples: | |
- headers: | |
acmeTracking: "ac998" | |
payload: | | |
{"itemid": "49f45afa-138a-4d60-b231-5ae9a53a759d", "type": "delivery", "count": 100, "eventtimestamp": "2021-03-10T13:20:50.52Z"} | |
- payload: | | |
{"itemid": "1018962c-81ab-11eb-8dcd-0242ac130003", "type": "customer-sale", "count": -2, "eventtimestamp": "2021-03-09T11:04:13.12Z"} | |
WEST.WAREHOUSE: | |
description: |- | |
 | |
Events about stock movements in the West transfers warehouse | |
subscribe: | |
operationId: consumeWestStockEvent | |
bindings: | |
$ref: '#/components/operationBindings/ourKafkaConsumerSettings' | |
message: | |
$ref: '#/components/messages/stockTransferEvent' | |
EAST.WAREHOUSE: | |
description: |- | |
 | |
Events about stock movements in the East transfers warehouse | |
subscribe: | |
operationId: consumeEastStockEvent | |
bindings: | |
$ref: '#/components/operationBindings/ourKafkaConsumerSettings' | |
message: | |
$ref: '#/components/messages/stockTransferEvent' | |
TEMPERATURE: | |
description: Temperature sensor readings from all warehouses | |
publish: | |
operationId: produceTemperature | |
bindings: | |
kafka: | |
clientId: | |
type: string | |
pattern: '^[a-z]{22}$' | |
message: | |
name: temperatureReading | |
title: Temperature sensor reading | |
summary: Sensor readings from IoT platform in all warehouses | |
tags: | |
- name: central | |
description: Events relating to the central warehouse | |
- name: east | |
description: Events relating to the East warehouse | |
- name: west | |
description: Events relating to the West warehouse | |
bindings: | |
kafka: | |
key: | |
type: string | |
enum: | |
- central | |
- east | |
- west | |
headers: | |
type: object | |
properties: | |
sensortype: | |
description: IoT sensor type code | |
type: string | |
acmecode: | |
type: integer | |
minimum: 1 | |
maximum: 9 | |
schemaFormat: 'application/vnd.apache.avro;version=1.9.0' | |
contentType: 'application/octet-stream' | |
payload: | |
$ref: 'https://gist.githubusercontent.com/dalelane/8b0ddf174e7f5186a7e4407c6f289346/raw/1a7018afcf46599a2529c2eef762b8f88672521c/temperature.avsc' | |
examples: | |
- headers: | |
sensortype: 'rpibd' | |
acmecode: 7 | |
payload: | |
warehouse: CENTRAL | |
sensorid: abcd1234 | |
temp: 14.3 | |
# --- | |
components: | |
operationBindings: | |
ourKafkaConsumerSettings: | |
kafka: | |
clientId: | |
type: string | |
pattern: '^[a-z]{22}$' | |
groupId: | |
type: string | |
pattern: '^[A-Z]{10}[1-5]$' | |
messages: | |
stockTransferEvent: | |
name: stockEventTransfer | |
title: Stock event | |
summary: Transfer warehouse stock change | |
description: Description of a change to the stock level in the **West** or **East** warehouses | |
schemaFormat: 'application/vnd.aai.asyncapi;version=2.0.0' | |
contentType: 'application/json' | |
tags: | |
- name: east | |
description: Events relating to the East warehouse | |
- name: west | |
description: Events relating to the West warehouse | |
- name: stock | |
description: Events relating to stock levels | |
headers: | |
type: object | |
properties: | |
acmeTracking: | |
description: |- | |
If the event was generated by the ACME system, the tracking ID used for | |
correlation purposes will be included in this header. | |
type: string | |
payload: | |
type: object | |
required: | |
- itemid | |
- count | |
- eventtimestamp | |
properties: | |
itemid: | |
description: Catalog id for the item | |
type: string | |
format: uuid | |
type: | |
description: Type of event that led to the stock change | |
type: string | |
default: inter-warehouse-transfer | |
enum: | |
- customer-sale | |
- delivery | |
- inter-warehouse-transfer | |
count: | |
description: Change to the number of items. Positive values indicate increases in stock, negative values indicate decreases in stock level. | |
type: integer | |
eventtimestamp: | |
description: Time that the stock level change was recorded | |
type: string | |
format: date-time | |
signedby: | |
description: Userid of the staff member who approved the transfer. Not required if the transfer was automated | |
type: string | |
format: email | |
additionalProperties: false | |
bindings: | |
kafka: | |
key: | |
type: string | |
enum: | |
- customer-sale | |
- delivery | |
- inter-warehouse-transfer | |
examples: | |
- headers: | |
acmeTracking: "ac998" | |
payload: | | |
{"itemid": "49f45afa-138a-4d60-b231-5ae9a53a759d", "type": "delivery", "count": 100, "eventtimestamp": "2021-03-10T13:20:50.52Z"} | |
- payload: | | |
{"itemid": "1018962c-81ab-11eb-8dcd-0242ac130003", "type": "customer-sale", "count": -2, "eventtimestamp": "2021-03-09T11:04:13.12Z"} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment