asyncapi Binding
asyncapi Binding
Zilla runtime asyncapi
binding.
name: zilla-mqtt-kafka-broker
bindings:
asyncapi_server:
type: asyncapi
kind: server
options:
specs:
my-mqtt-api-spec: mqtt/asyncapi.yaml
exit: asyncapi_proxy
asyncapi_proxy:
type: asyncapi
kind: proxy
options:
specs:
my-mqtt-api-spec:
my-kafka-api-spec:
catalog:
my_catalog:
subject: petstore
version: latest
my-kafka-api-spec:
my-kafka-api-spec:
catalog:
my_catalog:
subject: petstore
version: latest
mqtt-kafka:
channels:
sessions: mqttSessions
retained: mqttRetained
messages: mqttMessages
routes:
- when:
- api-id: my-mqtt-api-spec
operation-id: sendEvents
exit: asyncapi_client
with:
api-id: my-kafka-api-spec
operation-id: toSensorData
- when:
- api-id: my-mqtt-api-spec
operation-id: receiveEvents
exit: asyncapi_client
with:
api-id: my-kafka-api-spec
operation-id: onSensorData
asyncapi_client:
type: asyncapi
kind: client
options:
specs:
my-kafka-api-spec:
catalog:
my_catalog:
subject: petstore
version: latest
tcp:
host: localhost
port:
- 9092
Summary
Defines a binding with asyncapi
spec, with server
or proxy
or client
behavior.
The server
kind asyncapi
binding creates composite of tcp
, tls
, and mqtt
or http
bindings with server kind and adapts MQTT/HTTP streams to AsyncAPI streams.
The proxy
kind asyncapi
binding creates composite of mqtt-kafka
binding with proxy kind mapping MQTT streams to Kafka streams.
The client
kind asyncapi
binding creates composite of kafka
or mqtt
or http
, and tls
, tcp
bindings with client kind and adapts AsyncAPI streams to Kafka/MQTT/HTTP streams.
Configuration
Properties
- kind*
- options
- mqtt-kafka
- routes[].when
- routes[].exit*
- routes[].with
- exit
* required
kind*
enum
[ "client", "proxy", "server" ]
Behave as a asyncapi
client
or proxy
or server
.
kind: server
options
object
asyncapi
-specific options.
specs:
http_api:
servers:
- name: plain
catalog:
my_catalog:
subject: petstore
version: latest
options.specs
object
as map of named properties
specs specific options
specs.catalog
object
as map of named properties
catalog specific options.
catalog.subject
string
Subject name used when storing the catalog artifact.
catalog.version
string
Catalog artifact version to use.
specs.servers
object
servers.url
string
The server to match based on the server's url
in an asyncapi 2.x
spec only.
servers.host
string
The server to match based on the server's host
in an asyncapi 3.x
spec only.
servers.pathname
string
The server pathname to match based on the server's pathname
in an asyncapi 3.x
spec only.
options.tcp
object
client
specific tcp
options.
tpc.host
string
Hostname or IP address.
tcp.port
integer
|string
|array
ofinteger
|array
ofstring
Port number(s), including port number ranges.
options.http
object
http specific options.
http.authorization
object
as map of named properties
Authorization by guard for the HTTP/1.1
and HTTP/2
protocols.
authorization:
jwt:
credentials:
headers:
authorization: Bearer {credentials}
authorization.credentials
object
Defines how to extract credentials from the HTTP request.
credentials.cookies
map
ofname: value
properties
Named cookie value pattern with {credentials}
.
credentials.headers
map
ofname: value
properties
Named header value pattern with {credentials}
, e.g. "Bearer
{credentials}"
.
credentials.query
map
ofname: value
properties
Named query parameter value pattern with {credentials}
.
options.tls
object
tls
specific options.
tls.version
string
Protocol version.
tls.keys
array
ofstring
A list of reference names for the Vault key.
tls.trust
array
ofstring
A list of reference names for the Vault certificate.
tls.signers
array
ofstring
A list of reference names for the Vault signer certificate.
tls.trustcacerts
boolean
| Default:true
when trust isnull
Trust CA certificates.
tls.sni*
array
ofstring
A list of the Server Name Indications.
tls.alpn
array
ofstring
Application protocols.
tls.mutual
enum
[ "required", "requested", "none" ] | Default:"none"
Mutual authentication.
mqtt-kafka
object
mqtt-kafka
binding specific options.
mqtt-kafka.channels
object
AsyncAPI Kafka channels describing the necessary topics for the MQTT-Kafka mapping.
mqtt-kafka:
channels:
sessions: mqttSessions
retained: mqttRetained
messages: mqttMessages
channels.sessions
string
AsyncAPI Kafka sessions channel.
sessions: mqttSessions
channels.retained
string
AsyncAPI Kafka retained channel.
retained: mqttRetained
channels.messages
string
AsyncAPI Kafka messages channel.
messages: mqttMessages
routes[].when
array
ofobject
List of conditions to match this route when adapting asyncapi
MQTT streams to asyncapi
Kafka streams.
Read more: When a route matches
when[].api-id
string
AsyncAPI spec identifier that matches from asyncapi
binding MQTT stream.
when[].operation-id
string
AsyncAPI OperationId that can be mapped between AsyncAPI MQTT and AsyncAPI Kafka spec
routes[].exit*
string
Default exit binding when no conditional routes are viable.
routes:
- when:
...
exit: asyncapi_client
routes[].with
object
Defines the route with the AsyncAPI spec identifier and OperationId.
with:
api-id: my-asyncapi-spec
with.api-id
string
AsyncAPI spec identifier that the route exits with to the next binding
with.operation-id
string
AsyncAPI OperationId that the route exits with to the next binding
exit
string
Default exit binding.
exit: echo_server
* required