Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ing-bank/baker
Orchestrate microservice-based process flows
https://github.com/ing-bank/baker
functions-as-a-service hacktoberfest microservices orchestration petri-net scala serverless
Last synced: 5 days ago
JSON representation
Orchestrate microservice-based process flows
- Host: GitHub
- URL: https://github.com/ing-bank/baker
- Owner: ing-bank
- License: mit
- Created: 2016-12-05T12:56:57.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-12-09T13:27:01.000Z (17 days ago)
- Last Synced: 2024-12-14T04:03:48.008Z (12 days ago)
- Topics: functions-as-a-service, hacktoberfest, microservices, orchestration, petri-net, scala, serverless
- Language: Scala
- Homepage: https://ing-bank.github.io/baker/
- Size: 167 MB
- Stars: 336
- Watchers: 17
- Forks: 83
- Open Issues: 40
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![Build Status](https://github.com/ing-bank/baker/actions/workflows/ci.yml/badge.svg)](https://github.com/ing-bank/baker/actions/workflows/ci.yml)
[![Maven Central](https://img.shields.io/maven-central/v/com.ing.baker/baker-runtime_2.13.svg?label=Maven%20Central&logo=apachemaven)](https://search.maven.org/artifact/com.ing.baker/baker-runtime_2.13)
[![Code Coverage Status](https://codecov.io/gh/ing-bank/baker/graph/badge.svg)](https://codecov.io/gh/ing-bank/baker)# 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](https://ing-bank.github.io/baker/)
- [Concepts](https://ing-bank.github.io/baker/sections/concepts/): high level concepts and terminology
- [Recipe DSL](https://ing-bank.github.io/baker/sections/cookbook/recipe-dsl/): how to use the recipe DSL
- [Visualization](https://ing-bank.github.io/baker/sections/cookbook/visualizations/): how to visualize a recipe
- [Baker Talk @ J-Fall 2021](https://www.youtube.com/watch?v=U4aCUT9zIFk): 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.Java DSL
```java
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());
```Kotlin DSL
```kotlin
val recipe = recipe("Web shop") {
sensoryEvents {
event()
event()
event()
}
interaction()
interaction {
requiredEvents {
event()
}
}
interaction()
interaction {
requiredEvents {
event()
}
}
defaultFailureStrategy = retryWithIncrementalBackoff {
initialDelay = 100.milliseconds
until = deadline(24.hours)
maxTimeBetweenRetries = 10.minutes
}
}
```Scala DSL
```scala
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()
)
```Visualization
Events are gray, ingredients orange, and interactions lilac:
![](docs/images/webshop.svg)
## Getting Started
Baker is released to [Maven Central](https://search.maven.org/search?q=g:com.ing.baker). To use Baker you need three
modules.1. recipe-dsl: DSL to describe recipes in a declarative manner
2. compiler: Compiles recipes into models the runtime can execute
3. runtime: The runtime to manage and execute recipes> **Note**
> If you want to use the Kotlin DSL add `baker-recipe-dsl-kotlin_2.13` instead of `baker-recipe-dsl_2.13`.### Maven
```xml
com.ing.baker
baker-recipe-dsl_2.13
4.1.0com.ing.baker
baker-compiler_2.13
4.1.0com.ing.baker
baker-runtime_2.13
4.1.0```
### Gradle
```groovy
implementation 'com.ing.baker:baker-recipe-dsl_2.13:4.1.0'
implementation 'com.ing.baker:baker-compiler_2.13:4.1.0'
implementation 'com.ing.baker:baker-runtime_2.13:4.1.0'
```### Scala SBT
Baker gets compiled and released for both 2.13.
```scala
libraryDependencies += "com.ing.baker" % "baker-recipe-dsl_2.13" % "4.1.0"
libraryDependencies += "com.ing.baker" % "baker-compiler_2.13" % "4.1.0"
libraryDependencies += "com.ing.baker" % "baker-runtime_2.13" % "4.1.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.### Compile and test
To compile and test all libraries:
```bash
sbt
> compile
> test
```To cross compile all libraries for Scala 2.12 and 2.13:
```bash
sbt
> +compile
> +test
```### Compile or test a single project
To build a single project (baker-akka-runtime, baker-anotations, etc...):
1. Find the name of the project by running:
```bash
sbt
> projects
```2. Open the desired project via `sbt`:
```bash
sbt
> project
> compile
> test
```