Skip to content

Commit

Permalink
update to AsyncAPI 3
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkralidis committed Jan 15, 2024
1 parent eaa1801 commit fe61216
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 62 deletions.
65 changes: 44 additions & 21 deletions extensions/pubsub/examples/yaml/asyncapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,57 @@ info:

servers:
mqtt_prod:
url: example.org
host: example.org
protocol: mqtt
description: MQTT endpoint
security:
- user-password: []

defaultContentType: application/json

channels:
collections:
subscribe:
message:
$ref: '#/components/messages/collection_msg'
collections/wthr_stn:
subscribe:
message:
$ref: '#/components/messages/collection_msg'
collections/stream_gage:
subscribe:
message:
$ref: '#/components/messages/collection_msg'
collections/wthr_stn/items:
subscribe:
message:
$ref: '#/components/messages/wthr_stn_msg'
collections/stream_gage/items:
subscribe:
message:
$ref: '#/components/messages/stream_gage_msg'
notify-collections:
address: collections
messages:
$ref: '#/components/messages/collection_msg'
notify-collections-wthr-stn:
address: collections/wthr_st:
messages:
$ref: '#/components/messages/collection_msg'
notify-collections-stream-gage:
address: collections/stream_gage:
messages:
$ref: '#/components/messages/collection_msg'
notify-collections-wthr_stn-items:
address: collections/wthr_stn/items:
messages:
$ref: '#/components/messages/wthr_stn_msg'
notify-collections-stream_gage-items:
address: collections/stream_gage/items:
messages:
$ref: '#/components/messages/stream_gage_msg'

operations:
notify-collections:
action: receive
channel:
$ref: '#/channels/notify-collections'
notify-collections-wthr-stn:
action: receive
channel:
$ref: '#/channels/notify-collections-wthr-stn'
notify-collections-stream-gage:
action: receive
channel:
$ref: '#/channels/notify-collections-stream_gage'
notify-collections-wthr_stn-items:
action: receive
channel:
$ref: '#/channels/notify-collections-wthr_stn-items'
notify-collections-stream_gage-items:
action: receive
channel:
$ref: '#/channels/notify-collections-stream_gage-items'

components:
messages:
Expand Down
111 changes: 70 additions & 41 deletions extensions/pubsub/standard/sections/annex-pubsub.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The API is described using the https://www.asyncapi.com/[AysncAPI 2.5.0 specific
====
[source,yaml]
----
include::../examples/yaml/asyncapi.yaml[]
include::../../examples/yaml/asyncapi.yaml[]
----
====

Expand All @@ -19,7 +19,7 @@ Breaking down into the components:
====
[source,yaml]
----
asyncapi: '2.5.0'
asyncapi: '3.0.0'
info:
title: AsyncAPI demo
version: '0.0.1'
Expand All @@ -30,15 +30,15 @@ Breaking down into the components:
email: [email protected]
----
====
* The `asyncapi` field indicates you use the AsyncAPI version 2.5.0.
* The `asyncapi` field indicates you use the AsyncAPI version 3.0.0.
* The `info` field holds information about the API, such as its name, version, description, and license.

====
[source,yaml]
----
servers:
mqtt_prod:
url: example.org
host: example.org
protocol: mqtt
protocolVersion: 3.1.1
description: MQTT endpoint
Expand All @@ -48,7 +48,7 @@ Breaking down into the components:
----
====
* Each `server` object provides the following fields:
** `url`: URL of the target broker (this may be relative to the API document)
** `host`: the server hostname and port
** `protocol`: Pub/Sub protocol supported by the server
** `protocolVersion`: version of the Pub/Sub protocol supported by the server
** `description`: string describing the host
Expand All @@ -58,7 +58,7 @@ Breaking down into the components:
----
servers:
mqtt:
url: example.org
host: example.org
protocol: mqtt
protocolVersion: 3.1.1
description: MQTT endpoint
Expand All @@ -68,7 +68,7 @@ servers:
- 1883
default: 1883
amqp:
url: example.org
host: example.org
protocol: amqp
protocolVersion: 1.0.0
description: AMQP endpoint
Expand All @@ -86,45 +86,45 @@ Different Pub/Sub protocols are supported as additional server objects, and can
[source,yaml]
----
channels:
collections:
x-ogc-api-link:
rel: data
type: application/json
href: https://example.org/collections
subscribe:
notify-collections:
address: collections
x-ogc-api-link:
rel: data
type: application/json
href: https://example.org/collections
message:
$ref: '#/components/messages/collection_msg'
collections/wthr_stn:
x-ogc-api-link:
rel: collection
type: application/json
href: https://example.org/collections/wthr_stn
subscribe:
message:
notify-collections/wthr_stn:
address: collections/wthr_stn
x-ogc-api-link:
rel: collection
type: application/json
href: https://example.org/collections/wthr_stn
messages:
$ref: '#/components/messages/collection_msg'
collections/stream_gage:
x-ogc-api-link:
rel: collection
type: application/json
href: https://example.org/collections/stream_gage
subscribe:
message:
notify-collections-stream_gage:
address: collections/stream_gage
x-ogc-api-link:
rel: collection
type: application/json
href: https://example.org/collections/stream_gage
messages:
$ref: '#/components/messages/collection_msg'
collections/wthr_stn/items:
x-ogc-api-link:
rel: items
type: application/json
href: https://example.org/collections/stream_gage/items
subscribe:
message:
notify-collections-wthr_stn-items:
address: collections/wthr_stn/items
x-ogc-api-link:
rel: items
type: application/json
href: https://example.org/collections/stream_gage/items
messages:
$ref: '#/components/messages/wthr_stn_msg'
collections/stream_gage/items:
x-ogc-api-link:
rel: items
type: application/json
href: https://example.org/collections/stream_gage/items
subscribe:
message:
collections-stream_gage-items:
address: collections/stream_gage/items
x-ogc-api-link:
rel: items
type: application/json
href: https://example.org/collections/stream_gage/items
messages:
$ref: '#/components/messages/stream_gage_msg'
----
====
Expand All @@ -139,6 +139,35 @@ Different Pub/Sub protocols are supported as additional server objects, and can
** `collections/wthr_stn/items`
** `collections/stream_gage/items`

====
----
[source,yaml]
operations:
notify-collections:
action: receive
channel:
$ref: '#/channels/notify-collections'
notify-collections-wthr-stn:
action: receive
channel:
$ref: '#/channels/notify-collections-wthr-stn'
notify-collections-stream-gage:
action: receive
channel:
$ref: '#/channels/notify-collections-stream_gage'
notify-collections-wthr_stn-items:
action: receive
channel:
$ref: '#/channels/notify-collections-wthr_stn-items'
notify-collections-stream_gage-items:
action: receive
channel:
$ref: '#/channels/notify-collections-stream_gage-items'
----
====

* The `operations` section lists the required operations and their send and receive capabiliites.

====
[source,yaml]
----
Expand Down

0 comments on commit fe61216

Please sign in to comment.