Giter Site home page Giter Site logo

bellmit / domain-eventing Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tfredrich/domain-eventing

0.0 1.0 0.0 1.8 MB

Small, lightweight Java library to enable Domain Events (per Eric Evans, DDD) using an internal queue and asynchronous processing within a single JVM. Also supports asynchronous eventing across clustered JVMs using Akka or HazelCast.

License: Apache License 2.0

Java 100.00%

domain-eventing's Introduction

Stories in Ready
Build Status

Overview

Domain-Eventing implements the Domain Events concept from Eric Evans' Domain Driven Design. Enables simple messaging for domain models within a single JVM, or using a distributed event bus, message across a cluster of JVMs.

This simple Java library provides a Singleton interface (see DomainEvents class) to create event bus(ses) and to publish events (which are just POJOs) throughout the domain layer (POJOs must be Serializable for a distributed event bus).

Event handlers simply implement the EventHandler interface, which has two methods, handle(Object) and handles(Class). The handle() method is the implementation for processing the domain event and handles() returns a boolean indicating whether that particular EventHandler can process the given event.

Why Domain Eventing Instead of Messaging or ESB?

Messaging systems or ESB (Enterprise Service Bus) are very heavy and resource intensive. Small, quick, inter-application messages don't usually need to be broadcast enterprise wide. For instance, within an eventual-consistency database model, cascade deletes may occur asynchronously, outside of the request. This is a great candidate for inter-application eventing instead of leveraging full-up JMS or other messaging system.

The domain eventing model supported is publish/subscribe (pub/sub)--sending messages to all subsribers that can process it. There is no concept within this library of point-to-point or single consumer for a message and is, therefore, left as an exercise for the reader... :-)

Event Production

In this model, published events stay within the current Java virtual machine (JVM). This is the simplest and fastest option. However, as published events are in an in-memory queue, it is possible to lose messages if the JVM goes down unexpectedly.

Maven Usage

Stable:

		<dependency>
			<groupId>com.strategicgains.domain-eventing</groupId>
			<artifactId>domain-eventing-core</artifactId>
			<version>1.0</version>
		</dependency>

OR (for Akka-based eventing):

		<dependency>
			<groupId>com.strategicgains.domain-eventing</groupId>
			<artifactId>domain-eventing-akka</artifactId>
			<version>1.0</version>
		</dependency>

Development:

		<dependency>
			<groupId>com.strategicgains.domain-eventing</groupId>
			<artifactId>domain-eventing-core</artifactId>
			<version>1.1-SNAPSHOT</version>
		</dependency>

OR (for Akka-based eventing):

		<dependency>
			<groupId>com.strategicgains.domain-eventing</groupId>
			<artifactId>domain-eventing-akka</artifactId>
			<version>1.1-SNAPSHOT</version>
		</dependency>

Or download the jar directly from: http://search.maven.org/#search%7Cga%7C1%7C%22domain-eventing%22

Note that to use the SNAPSHOT version, you must enable snapshots and a repository in your pom file as follows:

  <profiles>
    <profile>
       <id>allow-snapshots</id>
          <activation><activeByDefault>true</activeByDefault></activation>
       <repositories>
         <repository>
           <id>snapshots-repo</id>
           <url>https://oss.sonatype.org/content/repositories/snapshots</url>
           <releases><enabled>false</enabled></releases>
           <snapshots><enabled>true</enabled></snapshots>
         </repository>
       </repositories>
     </profile>
  </profiles>

Release Notes

1.1 - SNAPSHOT (in 'master' branch)

  • Introduced domain-eventing-kafka supporting Kafka-based eventing.
  • Upgraded to Hazelcast version 3.6.2
  • Upgraded version akka-actor_2.11 version 2.3.15

1.0 - Release 10 Feb 2016

  • Added domain-eventing-akka, supporting Akka-based eventing. Hazelcast eventing support will no longer be maintained unless somebody hollers.
  • Requires Java 1.8 (due to Akka support).

0.4.5 - Released 2 Dec 2014

  • Fixed misspelling of method LocalEventBusBuilder.addPublishableEventType().

0.4.4 - Released 29 May 2014

  • Upgraded to Hazelcast 3.3 EA

0.4.3 - Released 4 Mar 2013

  • Updated Hazelcast from 2.4 to 2.5

0.4.2 - Released 30 Jan 2013

  • Introduced DomainEvents.publish(String, EventBus) to enable publishing to a specific, named EventBus implementation.
  • Changed internal Map, handlersByEvent, to a ConcurrentHashMap instead of a HashMap, since it does get manipulated during execution.

0.4.1 - Released 16 Jan 2013

  • Removed Ant build-related files
  • Ensured Java 1.6 compatible artifact is released.

0.4.0 - Released 10 Jan 2013

  • Introduced Maven build
  • Released to Maven Central repository

0.3.0

  • Introduced HazelCast for seamless intra-cluster (cross-node, multi-JVM) domain eventing.

0.2.0 - June 27, 2012

  • Removed constraint of having to implement DomainEvent marker interface in event messages.
  • Introduced EventQueue, allowing multiple EventMonitor threads to be processing events from the queue simultaneously.

0.1.0

  • Initial release.

domain-eventing's People

Contributors

tfredrich avatar clark-hobbie avatar waffle-with-pears avatar

Watchers

James Cloos 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.