Baker
Orchestrate microservice-based process flows
Install / Use
/learn @ing-bank/BakerREADME
Baker
Baker is a library that provides a simple and intuitive way to orchestrate microservice-based process flows.
You declare your orchestration logic as a recipe using the Java, Kotlin, or Scala DSL. A recipe consists of
interactions (system calls), ingredients (data), and events.
Bakers ability to visualize recipes provides a powerful communication tool that helps product owners, architects, and engineers to have a common understanding of the business process. This feature allows you to easily share your recipe with others, enabling collaboration and feedback.
Baker allows for the reuse of common interactions across different recipes, promoting consistency and reducing duplication. With Baker, you can quickly assemble complex process flows by reusing pre-existing building blocks that have been built by other teams within your company.
Use the list below to learn more about Baker:
- Documentation
- Concepts: high level concepts and terminology
- Recipe DSL: how to use the recipe DSL
- Visualization: how to visualize a recipe
- Baker Talk @ J-Fall 2021: API orchestration taken to the next level
A bird's-eye view of Baker
A recipe is the blueprint of your business process. To create this blueprint you use the Java, Kotlin, or Scala DSL. The examples below demonstrate a recipe for a simple web shop process.
<details> <summary>Java DSL</summary>final Recipe recipe=new Recipe("Web shop")
.withSensoryEvents(
CustomerInfoReceived.class,
OrderPlaced.class,
PaymentMade.class
)
.withInteractions(
InteractionDescriptor.of(ValidateOrder.class),
InteractionDescriptor.of(ReserveItems.class)
.withRequiredEvent(PaymentMade.class),
InteractionDescriptor.of(ShipGoods.class),
InteractionDescriptor.of(SendInvoice.class)
.withRequiredEvent(GoodsShipped.class)
)
.withDefaultFailureStrategy(
new RetryWithIncrementalBackoffBuilder()
.withInitialDelay(Duration.ofMillis(100))
.withDeadline(Duration.ofHours(24))
.withMaxTimeBetweenRetries(Duration.ofMinutes(10))
.build());
</details>
<details>
<summary>Kotlin DSL</summary>
val recipe = recipe("Web shop") {
sensoryEvents {
event<CustomerInfoReceived>()
event<OrderPlaced>()
event<PaymentMade>()
}
interaction<ValidateOrder>()
interaction<ReserveItems> {
requiredEvents {
event<PaymentMade>()
}
}
interaction<ShipGoods>()
interaction<SendInvoice> {
requiredEvents {
event<GoodsShipped>()
}
}
defaultFailureStrategy = retryWithIncrementalBackoff {
initialDelay = 100.milliseconds
until = deadline(24.hours)
maxTimeBetweenRetries = 10.minutes
}
}
</details>
<details>
<summary>Scala DSL</summary>
val recipe: Recipe = Recipe("Web shop")
.withSensoryEvents(
Event[CustomerInfoReceived],
Event[OrderPlaced],
Event[PaymentMade]
)
.withInteractions(
ValidateOrder,
ReserveItems
.withRequiredEvent(Event[PaymentMade])
ShipGoods,
SendInvoice
.withRequiredEvent(goodsShipped)
)
.withDefaultFailureStrategy(
RetryWithIncrementalBackoff
.builder()
.withInitialDelay(100 milliseconds)
.withUntil(Some(UntilDeadline(24 hours)))
.withMaxTimeBetweenRetries(Some(10 minutes))
.build()
)
</details>
<details>
<summary>Visualization</summary>
Events are gray, ingredients orange, and interactions lilac:
Getting Started
Baker is released to Maven Central. To use Baker you need three modules.
- recipe-dsl: DSL to describe recipes in a declarative manner
- compiler: Compiles recipes into models the runtime can execute
- runtime: The runtime to manage and execute recipes
Note If you want to use the Kotlin DSL add
baker-recipe-dsl-kotlininstead ofbaker-recipe-dsl.
Maven
<dependency>
<groupId>com.ing.baker</groupId>
<artifactId>baker-recipe-dsl</artifactId>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>com.ing.baker</groupId>
<artifactId>baker-compiler</artifactId>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>com.ing.baker</groupId>
<artifactId>baker-runtime</artifactId>
<version>5.0.0</version>
</dependency>
Gradle
implementation 'com.ing.baker:baker-recipe-dsl:5.0.0'
implementation 'com.ing.baker:baker-compiler:5.0.0'
implementation 'com.ing.baker:baker-runtime:5.0.0'
Scala SBT
Baker gets compiled and released for scala 2.13.
libraryDependencies += "com.ing.baker" % "baker-recipe-dsl" % "5.0.0"
libraryDependencies += "com.ing.baker" % "baker-compiler" % "5.0.0"
libraryDependencies += "com.ing.baker" % "baker-runtime" % "5.0.0"
Contributing
We welcome your contributions! The simplest way to contribute to Baker is by creating a branch from a fork. You can then create a pull request on GitHub from your branch.
Configure Akka resolvers
Before you can compile the project you have to configure the Akka resolvers in a akka.sbt file.
- Get your own token to download the Akka dependencies at: https://account.akka.io/token
- Create an environment variable called AKKA_TOKEN with your token as value
Compile and test
To compile and test all libraries:
mvn clean install
To cross compile all libraries for Scala 2.12 and 2.13:
This is handled by Maven profiles or modules. See the pom.xml for details.
Compile or test a single project
To build a single project (baker-akka-runtime, baker-anotations, etc...):
- Find the name of the project by running:
Use Maven modules or submodules. For example:
mvn -pl <MODULE_NAME> clean install
- Open the desired project via Maven:
cd <MODULE_DIRECTORY>
mvn clean install
Related Skills
node-connect
347.6kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.6kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.6kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
