Git Product home page Git Product logo

baker's Introduction

Baker Logo

Build Status Maven Central codecov.io

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:

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
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
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
    }
}
Scala DSL
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:

Getting Started

Baker is released to Maven Central. 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

<dependency>
    <groupId>com.ing.baker</groupId>
    <artifactId>baker-recipe-dsl_2.13</artifactId>
    <version>3.6.3</version>
</dependency>
<dependency>
    <groupId>com.ing.baker</groupId>
    <artifactId>baker-compiler_2.13</artifactId>
    <version>3.6.3</version>
</dependency>
<dependency>
    <groupId>com.ing.baker</groupId>
    <artifactId>baker-runtime_2.13</artifactId>
    <version>3.6.3</version>
</dependency>

Gradle

implementation 'com.ing.baker:baker-recipe-dsl_2.13:3.6.3'
implementation 'com.ing.baker:baker-compiler_2.13:3.6.3'
implementation 'com.ing.baker:baker-runtime_2.13:3.6.3'

Scala SBT

Baker gets cross compiled and released for both Scala 2.12 and 2.13.

libraryDependencies += "com.ing.baker" % "baker-recipe-dsl_2.13" % "3.6.3"
libraryDependencies += "com.ing.baker" % "baker-compiler_2.13" % "3.6.3"
libraryDependencies += "com.ing.baker" % "baker-runtime_2.13" % "3.6.3"

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:

sbt 
> compile
> test

To cross compile all libraries for Scala 2.12 and 2.13:

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:
sbt 
> projects
  1. Open the desired project via sbt:
sbt
> project <PROJECT_NAME>
> compile
> test

baker's People

Contributors

vledicfranco avatar tim-linschoten avatar stasimus avatar jacum avatar bekiroguz avatar scala-steward avatar merlijn avatar nikolakasev avatar adilakhter avatar wwbakker avatar basdgrt avatar winitzki avatar wilmveel avatar pausa avatar anubhav0712 avatar jdin avatar jordymoos avatar kevinvandervlist avatar krisvandebroek avatar nightscape avatar p3trur0 avatar sander avatar sander-cb avatar jlengrand avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.