elara

Efficient, zero garbage framework to implement event sourcing applications

License

License

GroupId

GroupId

org.tools4j
ArtifactId

ArtifactId

elara-samples
Last Version

Last Version

1.7
Release Date

Release Date

Type

Type

pom
Description

Description

elara
Efficient, zero garbage framework to implement event sourcing applications
Project URL

Project URL

https://github.com/tools4j/elara
Source Code Management

Source Code Management

https://github.com/tools4j/elara.git

Download elara-samples

How to add to project

<!-- https://jarcasting.com/artifacts/org.tools4j/elara-samples/ -->
<dependency>
    <groupId>org.tools4j</groupId>
    <artifactId>elara-samples</artifactId>
    <version>1.7</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/org.tools4j/elara-samples/
implementation 'org.tools4j:elara-samples:1.7'
// https://jarcasting.com/artifacts/org.tools4j/elara-samples/
implementation ("org.tools4j:elara-samples:1.7")
'org.tools4j:elara-samples:pom:1.7'
<dependency org="org.tools4j" name="elara-samples" rev="1.7">
  <artifact name="elara-samples" type="pom" />
</dependency>
@Grapes(
@Grab(group='org.tools4j', module='elara-samples', version='1.7')
)
libraryDependencies += "org.tools4j" % "elara-samples" % "1.7"
[org.tools4j/elara-samples "1.7"]

Dependencies

compile (2)

Group / Artifact Type Version
org.tools4j : elara-core jar 1.7
org.tools4j : elara-chronicle jar 1.7

runtime (1)

Group / Artifact Type Version
org.hdrhistogram : HdrHistogram jar 2.1.12

Project Modules

There are no modules declared in this project.

Continuous Integration Maven Central Javadocs

elara

The tools4j elara project provides an efficient, zero garbage framework to implement event sourcing applications.

The event store is pluggable; a default implementation is available for chronicle queue.

Elara uses direct buffers as defined by the agrona library. For this reason elara applications are perfectly suited to integrate with SBE and aeron UDP/IPC messaging.

The elara library is used productively in applications in the financial industry. However elara is also under active development and some new plugins and features may be considered experimental especially if they are not released yet.

Overview

Introduction

There are excellent introductions to event sourcing out there. Some of our favorite links are

Elara Event Sourcing

Elara Event Sourcing

Terminology

  • Command: essentially an input message but enriched with timestamp, source and sequence number; can be a state modifying command or a query
  • Event: result of processing a command; instruction how to modify state or what output to generate
  • Command Log: persisted log that sequentially stores all incoming commands
  • Event Log: persisted event log that sequentially stores all routed events
  • Application State: transient in-memory state of the application; can be constructed from events via Event Applier
  • Input: a source of input commands, such as a message subscription
  • Output: transforms selected events into output messages and publishes them to downstream applications
  • Command Processor: handles command messages and has read-only access to application state; routes events
  • Event Applier: triggered by events (routed or replayed); modifies the application state according to the event instruction

Plugins

Plugins are optional features that can be configured when defining the application context. Third party plugins can be provided by implementing the plugin API.

Plugins can define their own state and applications can optionally access plugin state when defining the plugins in the elara context. By convention plugins define commands and events with negative types which marks them as 'admin' types so that they can be easily distinguished from non-negative application types.

Elara provides the following default plugins:

  • base: a plugin that is implicitly added and defines the base state required for all elara applications
  • boot: a plugin that issues commands and events indicating that an elara application has been started and initialised
  • timer: a plugin that allows routing of events to start and stop simple and periodic timers; the plugin injects commands to fire or expire timers which are then removed from the timer state through an event (see samples section for examples)
  • metrics: plugin to capture time and frequency metrics of the running application; a running application efficiently captures metrics in a message log file that can be inspected with the log printer tool
  • replication: [experimental] plugin to replicate events from a leader elara instance to follower instances that are applying events but do not process commands; follower instances have identical state as the leader (after applying all events and assuming deterministic application logic); together with the provided leader change commands applications can use this plugin to support rolling upgrades or implement manual or automatic fail-over strategies

Samples

Banking application

A simple banking app that supports the following commands:

  • Creation of a bank account
  • Money deposit, withdrawal and transfer

Sample code and test to run:

Timers

Timers are tricky with event sourcing. Elara provides timers through the timer plugin with support for once-off and periodic timers. The timer sample app demonstrates both timer types in action:

Maven/Gradle

Maven

<dependency>
        <groupId>org.tools4j</groupId>
        <artifactId>elara-core</artifactId>
        <version>1.7</version>
</dependency>

Gradle

api "org.tools4j:elara-core:1.7'

Download

You can download binaries, sources and javadoc from maven central:

org.tools4j
tools4j.org is a collection of Java libraries and tools.

Versions

Version
1.7
1.6
1.5
1.4
1.3
1.2
1.1
1.0-BETA