-
-
Notifications
You must be signed in to change notification settings - Fork 6
Aaptor Design
Identify real-world implementation to inform the design of RIDDL adapter language.
An event stream that needs to be transformed and adapted to existing domain language. This is
A single data stream needs to be re-routed to new topics in different Kafka/MQ/streams.
Translate older versions or schemas of commands into a new bounded context.
If/then/else that can call functions based on incoming data.
Handling mapping of an event stream in step-by-step functionality, probably defined using conditionals and functions.
- Conditionals determine the output of a mapping in an adapter
- Functions are placeholders that are generated into trait definitions
- Adapter language should only address data that needs changing
- In DDD+Reactive world, adapters are using ETL between domains and contexts
- Conditions can map to functions
An adapter resembles a consumer with some minor differences. In the future adapters may not always be message driven (there may be edge cases requiring non-message-driven ACLs), therefore we explicitly state event mapping and the message topic of origin.
topic STV is {
events {
ItemLoadedToVehicle is { vehicle: Id(Vehicle), item: Id(Item) }
}
}
adapter EDBAdapter {
condition ItemIsLate takes (Id(Item)) explained as { “determines if the item is late” }
transform HandleLateItem is from ItemLoadedToVehicle to EmailNotificationOfLateItem
transform MultipleItems is from ItemLoadedToVehicle to SomeOtherMessage
message mapping from topic STV {
on ItemLoadedToVehicle {
when condition ItemIsLate(ItemLoadedToVechicle.item) then {
publish to topic DistributionItemTopic
(use|run|execute|do) transform handleLateItem then { publish to NotificationTopic }
} else {
publish to DistributionItemTopic
}
when condition DistributionItem.ItemIsBig {
when condition DistributionItem.ItemRequiresAdditionalPayment {
publish to topic BillingItemTopic
}
}
}
on MultiItemEvent {
use transform MultipleItems {
publish to topic DistributionItemTopic
}
}
}
}
You can read the above code as the following in the RIDDL AST:
adapter <AdapterRef> {
message mapping from <TopicRef> {
<OnClause> {
<OnClauseStatement>
}
}
}
When an OnClauseStatement is broken into then and else clauses:
when <expression="condition ItemIsLate(input)"> (is true) then {
}
#Open Questions
Question
Answer
Date Answered
-
How verbose is existing EDB adapter written for Innovapost?
- We determined with that semi-verbose is the most user-friendly.
-
In RIDDL world, what is an adapter compared to an adapter in DDD world?
- We are opinionated that adapters will receive events 1-way via an event stream.
-
How do DDD “services” fit in?
- TBD