asyncapi proxy
asyncapi proxy
The asyncapi proxy binding creates composite of mqtt-kafka
binding with proxy kind mapping MQTT streams to Kafka streams.
asyncapi_proxy:
type: asyncapi
kind: proxy
options:
specs:
my-mqtt-api-spec:
catalog:
my_catalog:
subject: mqtt-streetlights
version: latest
my-kafka-api-spec:
catalog:
my_catalog:
subject: kafka-streetlights
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
Configuration (* required)
vault
string
Vault name.
options
object
The proxy
specific options.
specs:
http_api:
servers:
- name: plain
catalog:
my_catalog:
subject: petstore
version: latest
options.specs
object
as map of namedobject
properties
The specs
specific options.
specs.catalog
object
as map of namedobject
properties
To map defined catalog for schema retrieval based on catalog specific parameters.
catalog.subject*
string
Subject name used when storing the catalog artifact.
catalog.version
string
| Default:latest
Specific iteration or version of a registered schema in the defined catalog.
specs.servers
array
ofobject
The servers to match from the schema that are used when defining endpoints.
servers[].url
string
| Pattern:^([a-zA-Z0-9\\\\.-]+)(:(\\\\{[a-zA-Z_]+\\\\}|[0-9]+))?$
The server to match based on the server's url
in an asyncapi 2.x
spec only.
servers[].host
string
| Pattern:^([a-zA-Z0-9\\\\.-]+)(:(\\\\{[a-zA-Z_]+\\\\}|[0-9]+))?$
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
TCP options to connect to an external client.
tcp.host
string
Hostname or IP address.
tcp.port
integer
,string
,array
Port number(s), including port number ranges.
options.http
object
The http specific options.
http.authorization
object
as map of namedobject
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
object
as map of namedstring
properties
Named cookie value pattern with {credentials}
.
credentials.headers
object
as map of namedstring
properties
Named header value pattern with {credentials}
, e.g. "Bearer
{credentials}"
.
credentials.query*
object
as map of namedstring
properties
Named query parameter value pattern with {credentials}
.
options.kafka
object
The kafka
binding specific options.
kafka.topics
array
ofobject
Topic configuration.
topics[].name
string
Topic name.
topics[].key
enum
[avro
,double
,float
,int32
,int64
,json
,protobuf
,string
],object
Enforce validation for key
key.model*
enum
[avro
,double
,float
,int32
,int64
,json
,protobuf
,string
]
A schema or type to validate the topic's key. Refer to the individual model docs for type specific implementation.
topics[].value
enum
[avro
,double
,float
,int32
,int64
,json
,protobuf
,string
],object
Enforce validation for value
value.model*
enum
[avro
,double
,float
,int32
,int64
,json
,protobuf
,string
]
A schema or type to validate the topic's value. Refer to the individual model docs for type specific implementation.
topics[].defaultOffset
enum
[live
,historical
]
Fetch offset to use for new consumers
topics[].transforms
array
Extract key or value attributes from the typed Kafka message to apply to the Kafka message id or Kafka headers. The extract-key
property must come before the extract-headers
property if they both exist.
transforms:
- extract-key: ${message.key.id}
transforms:
- extract-headers:
my-kafka-header: ${message.value.test}
transforms:
- extract-key: ${message.value.id}
- extract-headers:
my-kafka-header: ${message.value.test}
transforms[].extract-key
string
| Pattern:^\\$\\{message\\.(key|value)\\.([A-Za-z_][A-Za-z0-9_]*)\\}$
Use a part of the Kafka message as the Kafka message key.
transforms[].extract-headers
object
as map of namedstring
properties | Pattern:^\\$\\{message\\.(key|value)\\.([A-Za-z_][A-Za-z0-9_]*)\\}$
Use a part of the Kafka message as a Kafka message header.
kafka.sasl
object
SASL credentials to use when connecting to kafka
brokers.
sasl.mechanism
enum
[plain
,scram-sha-1
,scram-sha-256
,scram-sha-512
]
Supports plain
and scram
mechanisms.
sasl.mechanism: plain
const
Configure credentials for the plain
sasl mechanism.
sasl.username*
string
SASL username.
sasl.password*
string
SASL password.
sasl.mechanism: scram-sha-1
const
Configure credentials for the scram-sha-1
sasl mechanism.
sasl.username*
string
SASL username.
sasl.password*
string
SASL password.
sasl.mechanism: scram-sha-256
const
Configure credentials for the scram-sha-256
sasl mechanism.
sasl.username*
string
SASL username.
sasl.password*
string
SASL password.
sasl.mechanism: scram-sha-512
const
Configure credentials for the scram-sha-512
sasl mechanism.
sasl.username*
string
SASL username.
sasl.password*
string
SASL password.
options.mqtt-kafka
object
The 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
options.http
object
The HTTP specific options.
http.authorization
object
as map of namedobject
properties
Authorization by guard for the HTTP/1.1
and HTTP/2
protocols.
authorization:
my_jwt_guard:
credentials:
headers:
authorization: Bearer {credentials}
authorization.credentials*
object
Defines how to extract credentials from the HTTP request.
credentials.cookies
object
as map of namedstring
properties
Named cookie value pattern with {credentials}
.
credentials.headers
object
as map of namedstring
properties
Named header value pattern with {credentials}
, e.g. "Bearer
{credentials}"
.
credentials.query*
object
as map of namedstring
properties
Named query parameter value pattern with {credentials}
.
options.mqtt
object
The MQTT specific options.
mqtt.authorization
object
as map of namedobject
properties
Authorization by guard for the HTTP/1.1
and HTTP/2
protocols.
authorization:
my_jwt_guard:
credentials:
headers:
authorization: Bearer {credentials}
authorization.credentials*
object
Defines how to extract credentials from the MQTT connect packet.
credentials.connect*
object
MQTT connect packet properties
connect.username
string
Extract credentials from the MQTT connect packet username property with {credentials}
, e.g. "Bearer
{credentials}"
.
connect.password
string
Extract credentials from the MQTT connect packet password property with {credentials}
, e.g. "Bearer
{credentials}"
.
options.tls
object
The 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
Trust CA certificates. When the this property is not explicitly set it will be automatically set to true
if tls.trust is null
.
tls.sni
array
ofstring
A list of the Server Name Indications.
tls.alpn
array
ofstring
Application protocols.
tls.mutual
enum
[required
,requested
,none
]
Mutual authentication. When the this property is not explicitly set it will be automatically set to none
if tls.trust is null
, otherwise it will be set to required
.
routes
array
ofobject
Conditional asyncapi
specific routes.
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
routes[].guarded
object
as map of namedarray
ofstring
List of roles required by each named guard to authorize this route.
routes:
- guarded:
my_guard:
- read:items
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[].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.
routes[].exit
string
Next binding when following this route.
routes:
- when:
...
exit: asyncapi_client
exit
string
Default exit binding when no conditional routes are viable.
exit: echo_server
telemetry
object
Defines the desired telemetry for the binding.
telemetry.metrics
array
Telemetry metrics to track
telemetry:
metrics:
- stream.*