This repository was archived by the owner on Apr 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
This repository was archived by the owner on Apr 11, 2024. It is now read-only.
Simplify configuration of the app within the spec file #59
Copy link
Copy link
Open
Labels
Description
We want to keep this application to be configured mostly from reading an AsyncAPI file.
However, current configuration is done at proxied servers, which forces the user to modify their current servers (e.g. Kafka servers) adding a custom extension (x-eventgateway
prefix).
Example:
servers:
asyncapi-kafka-test:
url: 'asyncapi-kafka-test-asyncapi-8f90.aivencloud.com:20472' # Kafka with 3 brokers.
protocol: kafka-secure
description: AsyncAPI Kafka test broker. Private.
x-eventgateway-dial-mapping: '0.0.0.0:20473,event-gateway-demo.asyncapi.org:20473|0.0.0.0:20474,event-gateway-demo.asyncapi.org:20474|0.0.0.0:20475,event-gateway-demo.asyncapi.org:20475' # Dynamic ports starts at 20473
Instead, I suggest we rather configure the app by using the servers that describe the app.
servers:
asyncapi-event-gateway-kafka-1:
url: 'event-gateway-demo.asyncapi.org:28003'
protocol: kafka
x-eventgateway:
proxy:
kafka:
server: asyncapi-kafka-test # as this is not a ref, this should be validated as we did in https://github.com/asyncapi/parser-js/pull/364
dialMapping: '0.0.0.0:20473,event-gateway-demo.asyncapi.org:20473|0.0.0.0:20474,event-gateway-demo.asyncapi.org:20474|0.0.0.0:20475,event-gateway-demo.asyncapi.org:20475'
The benefits are multiple:
- Existing servers are not changed.
- Port binding + adverstised URL (the url of the actual application) is already available in the server.
- Application can act as proxy of several servers by just creating a new server with a different port. Also supports different protocols. For example:
servers: asyncapi-event-gateway-kafka-2: url: 'event-gateway-demo.asyncapi.org:28004' # note this port is different, but real server behind is the same. x-eventgateway: proxy: kafka: server: another-different-asyncapi-kafka-test asyncapi-event-gateway-mqtt: url: 'event-gateway-demo.asyncapi.org:1883' x-eventgateway: proxy: mqtt: server: a-mqtt-server