camunda-community-hub / eze

Licence: other
Embedded Zeebe Engine

Programming Languages

kotlin
9241 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to eze

TypeScriptXX
🧷 Stay safe! Type-safe scripting for C++ using TypeScriptToLua and CMake with auto-generated declarations.
Stars: ✭ 33 (+153.85%)
Mutual labels:  embedded
zeeqs
Query API for aggregated Zeebe data
Stars: ✭ 37 (+184.62%)
Mutual labels:  zeebe
static string
A fixed capacity dynamically sized string
Stars: ✭ 46 (+253.85%)
Mutual labels:  embedded
PeripheralTemplateLibrary
Cross-platform, cross-MCU C++ template library for microcontrollers and peripheral devices
Stars: ✭ 52 (+300%)
Mutual labels:  embedded
oic
Open Instrument Control
Stars: ✭ 40 (+207.69%)
Mutual labels:  embedded
dd performances
DeepDetect performance sheet
Stars: ✭ 92 (+607.69%)
Mutual labels:  embedded
irq
Utilities for Interrupt handling
Stars: ✭ 12 (-7.69%)
Mutual labels:  embedded
OpenWare
Firmware for OWL devices
Stars: ✭ 23 (+76.92%)
Mutual labels:  embedded
tinypacks
A data serialization format for constrained environments like 8-bit and 16-bit microcontrollers.
Stars: ✭ 30 (+130.77%)
Mutual labels:  embedded
mros2
agent-less and lightweight communication library compatible with rclcpp for embedded devices
Stars: ✭ 72 (+453.85%)
Mutual labels:  embedded
NinjaCalc
An embedded engineering calculator toolbox for doing calculations in a breeze.
Stars: ✭ 14 (+7.69%)
Mutual labels:  embedded
mbedtls-esp8266
Updated and Upgraded mbedTLS library for the ESP8266 (probably ESP32 too)
Stars: ✭ 13 (+0%)
Mutual labels:  embedded
Ellie-Language
Ellie is a type-safe programing language that runs on embedded and sandboxed environments.
Stars: ✭ 16 (+23.08%)
Mutual labels:  embedded
simcom dam
Examples for simcoms downloadable modules (Qualcomm SoC)
Stars: ✭ 25 (+92.31%)
Mutual labels:  embedded
wymlp
tiny fast portable real-time deep neural network for regression and classification within 50 LOC.
Stars: ✭ 36 (+176.92%)
Mutual labels:  embedded
uC-CPU
Designed with Micriμm's renowned quality, scalability and reliability, the purpose of μC/ CPU is to provide a clean, organized ANSI C implementation of each processor's/compiler's hardware-dependent.
Stars: ✭ 31 (+138.46%)
Mutual labels:  embedded
ArduinoSpritzCipher
Spritz encryption system portable C library, CSPRNG, cryptographic hash and MAC functions, symmetric-key data encryption, and general-purpose functions. It's also an Arduino library.
Stars: ✭ 67 (+415.38%)
Mutual labels:  embedded
apex
Apex RTOS - A (somewhat) Linux compatible real time operating system
Stars: ✭ 15 (+15.38%)
Mutual labels:  embedded
incache
Powerful key/value in-memory storage or on disk to persist data
Stars: ✭ 16 (+23.08%)
Mutual labels:  in-memory
zhe
Lighter-than-air, peer-to-peer, bounded, non-blocking, non-threaded, etc., publish-subscribe networking
Stars: ✭ 44 (+238.46%)
Mutual labels:  embedded

Community badge: Incubating Community extension badge

Embedded Zeebe engine

A lightweight version of Zeebe from Camunda. It bundles Zeebe's workflow engine including some required parts to a library that can be used by other projects. Some parts of Zeebe, like clustering, are not included or are replaced with simpler implementations, for example with an In-Memory database.

The project was created as part of the Camunda Summer Hackdays 2021.

Features:

  • Support Zeebe clients and exporters
  • Read and write records from and to an in-memory log stream
  • Time-Travel API

Usage

Maven

Add one of the following dependency to your project (i.e. Maven pom.xml):

For the embedded engine:

<dependency>
  <groupId>org.camunda.community</groupId>
  <artifactId>eze</artifactId>
  <version>0.3.0</version>
</dependency>

For the JUnit5 extension:

<dependency>
  <groupId>org.camunda.community</groupId>
  <artifactId>eze-junit-extension</artifactId>
  <version>0.3.0</version>
</dependency>

Note that the library is written in Kotlin. In general, it works for all JVM languages, like Java. However, it may work best with Kotlin.

Bootstrap the Engine

Use the factory to create a new engine.

val engine: ZeebeEngine = EngineFactory.create()
engine.start()

// ...
engine.stop()

Connect a Zeebe Client

The engine includes an embedded gRPC gateway to support interactions with Zeebe clients.

Use the factory method of the engine to create a preconfigured Zeebe client.

val client: ZeebeClient = engine.createClient()

Or, create your own Zeebe client using the provided gateway address from the engine.

val client: ZeebeClient = ZeebeClient.newClientBuilder()
  .gatewayAddress(engine.getGatewayAddress())
  .usePlaintext()
  .build()

Read Records from the Log Stream

The engine stores all records (i.e. commands, events, rejections) on a append-only log stream.

Use the engine to read the records. It provides different methods based on the value type (e.g. processRecords(), processInstanceRecords()).

engine.processRecords().forEach { record ->
    // ...
}

engine.processInstanceRecords()
    .withElementType(BpmnElementType.PROCESS)
    .withIntent(ProcessInstanceIntent.ELEMENT_ACTIVATED)
    .forEach { record ->  
        // ...
    }               

For testing or debugging, you can print the records.

// print the most relevant parts of the records
engine.records().print(compact = true)

// print as raw JSON records
engine.records().print(compact = false)

Time Travel

The engine has an internal clock that is used for timer events or other time-dependent operations.

Use the engine clock to manipulate the time.

engine.clock().increaseTime(timeToAdd = Duration.ofMinutes(5))

Exporters

The engine supports Zeebe exporters. An exporter reads the records from the log stream and can export them to an external system.

Use the factory to create a new engine and register exporters.

val engine: ZeebeEngine = EngineFactory.create(exporters = listOf(HazelcastExporter()))

JUnit5 Extension

The project contains a JUnit5 extension to write tests more smoothly.

Add the @EmbeddedZeebeEngine annotation to your test class. The extension injects fields of the following types to interact with the engine:

  • ZeebeEngine
  • ZeebeClient
  • RecordStreamSource
  • ZeebeEngineClock
@EmbeddedZeebeEngine
class ProcessTest {

  // the extension injects the fields before running the test   
  lateinit var client: ZeebeClient
  lateinit var recordStream: RecordStreamSource
  lateinit var clock: ZeebeEngineClock

  @Test
  fun `should complete process`() {
    // given
    val process = Bpmn.createExecutableProcess("process")
        .startEvent()
        .endEvent()
        .done()

    client.newDeployCommand()
        .addProcessModel(process, "process.bpmn")
        .send()
        .join()

    // when
    val processInstanceResult = client.newCreateInstanceCommand()
        .bpmnProcessId("process")
        .latestVersion()
        .variables(mapOf("x" to 1))
        .withResult()
        .send()
        .join()

    // then
    assertThat(processInstanceResult.variablesAsMap)
        .containsEntry("x", 1)
  }

Docker

EZE can be run via docker. The benefits over running a normal Zeebe docker image are, the reductions of dependencies and components, which should make start up and execution much more performant.

docker run -p 26500:26500 -it ghcr.io/camunda-community-hub/eze:0.8.1

You can check with zbctl whether it works to access the engine.

$ zbctl status --insecure --address 0.0.0.0:26500
Cluster size: 1
Partitions count: 1
Replication factor: 1
Gateway version: A.B.C
Brokers:
  Broker 0 - 0.0.0.0:26500
    Version: X.Y.Z
    Partition 1 : Leader, Healthy

The usage of the Docker container is currently quite limited, since the client/user has no access to the log. The log is currently not exposed. Furthermore, it is not yet possible to configure an exporter, but hopefully soon.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].