Channel object have no traits field:
- it makes it difficult to compose channels with common definitions, specifically channel binding definitions that are by their definition not composable
- this is not consistent with other asyncapi building blocks like Servers, Messages, Operations
The proposal is to add traits object in the same fashion as other building blocks
Describe the solution you'd like
Add a Channel Trait Object and a traits field to the Channel Object, mirroring Operation Traits and Message Traits exactly:
- A
traits array on the Channel Object.
- A
channelTraits map under the Components Object for reuse.
- The same trait merge mechanism already defined for operations and messages. Traits apply in order; the Channel Object's own values take precedence. The merged result MUST be a valid Channel Object.
The Channel Trait Object carries the composable subset of channel fields (everything except the channel identity fields address and messages, and traits itself).
Example: compose Kafka bindings without exploding combinations
components:
channelTraits:
kafkaReplicated:
bindings:
kafka:
partitions: 6
replicas: 3
kafkaCompacted:
bindings:
kafka:
topicConfiguration:
cleanup.policy: [compact]
channels:
userSignedUp:
address: user.signedup
traits:
- $ref: '#/components/channelTraits/kafkaReplicated'
- $ref: '#/components/channelTraits/kafkaCompacted'
messages:
userSignedUp:
$ref: '#/components/messages/UserSignedUp'
Two orthogonal binding profiles compose into one channel instead of requiring a replicated-compacted channel definition. Add a third axis (e.g. retention) and you add one trait, not a multiplied set of channels.
Champion
@ivangsa — will drive the proposal PR, JSON Schema changes, and parser implementation.
Channel object have no
traitsfield:The proposal is to add
traitsobject in the same fashion as other building blocksDescribe the solution you'd like
Add a Channel Trait Object and a
traitsfield to the Channel Object, mirroring Operation Traits and Message Traits exactly:traitsarray on the Channel Object.channelTraitsmap under the Components Object for reuse.The Channel Trait Object carries the composable subset of channel fields (everything except the channel identity fields
addressandmessages, andtraitsitself).Example: compose Kafka bindings without exploding combinations
Two orthogonal binding profiles compose into one channel instead of requiring a
replicated-compactedchannel definition. Add a third axis (e.g. retention) and you add one trait, not a multiplied set of channels.Champion
@ivangsa — will drive the proposal PR, JSON Schema changes, and parser implementation.