Giter Site home page Giter Site logo

cdi's Introduction

Axon Framework CDI Support

This Axon Framework module provides support for the CDI programming model. It is a CDI portable extension integrating the Axon Framework and providing some intelligent defaults while still allowing for configuring overrides.

The current minimum supported versions are:

  • Axon Framework 3.3.5
  • CDI 1.1/Java EE 7
  • Java SE 8

We have so far tested sucessfully against Payara, WildFly, JBoss EAP and TomEE Plume. We will test the module with Thorntail (formerly WildFly Swarm) and WebSphere Liberty/Open Liberty. Contributions testing against WebSphere classic and WebLogic are welcome.

Usage

The artifact is not yet released to Maven Central and you have to build it locally for the time being. Once you have built the artifact locally, simply add the following dependency:

  <dependency>
    <groupId>org.axonframework</groupId>
    <artifactId>axon-cdi</artifactId>
    <version>0.1-SNAPSHOT</version>
  </dependency>

Automatic Configuration

The base Axon Framework is extremely powerful and flexible. What this extension does is to provide a number of sensible defaults for Axon applications while still allowing you reasonable configuration flexibility - including the ability to override defaults. As soon as you include the module in your project, you will be able to inject a number of Axon APIs into your code using CDI. These APIs represent the most important Axon Framework building blocks:

Overrides

You can provide configuration overrides for the following Axon artifacts by creating CDI producers for them:

For more details on these objects and the Axon Framework, please consult the Axon Framework Reference Guide.

Aggregates

You can define aggregate roots by placing a simple annotation org.axonframework.cdi.stereotype.Aggregate on your class. It will be automatically collected by the CDI container and registered.

Event Handlers and Query Handlers

Event handlers and query handlers must be CDI beans. They will be automatically registered with Axon for you.

Examples

Please have a look at the examples in the example folder.

Java EE

The Java EE example demonstrates usage inside any Java EE 7+ compatible application server much as Payara or WildFly. The example is a generic Maven web application you should be able to build on any IDE, generate a Java EE 7 war and deploy to your favorite application server. We have so far tested sucessfully against Payara, WildFly, JBoss EAP and TomEE Plume.

For convenience, we have added Cargo configurations in separate Maven profiles for each supported and tested application server.

  • To run the example against WildFly, simply execute the Maven target: mvn package cargo:run -Pwildfly
  • To run the example against JBoss EAP, simply execute the Maven target: mvn package cargo:run -Pjboss
  • To run the example against TomEE Plume, simply execute the Maven target: mvn package cargo:run -Ptomee

Java SE

The Java SE example demonstrates usage in a non-Java EE, Java SE environment that is CDI enabled (that could include a Servlet-only environment with CDI). Note that while the extension targets CDI 1.1, the example uses the CDI 2 Java SE bootstrap API. It is also easily possible to achieve the same functionality in CDI 1.1 using CDI implementation (such as Weld) specific Java SE bootstrap APIs (in the same vein it is possible to use the CDI 2 Java SE bootstrap API in Servlet containers). The example is a generic Maven Java SE application you should be able to build on any IDE, generate a Java SE executable jar and run from the command line using java -jar.

For convenience, we have added a Maven exec Java plugin in the Maven configuration. You can run the application by simply executing the Maven target: mvn package exec:java

Advanced Usage

Usage of JPA Event Store

If you want to use the JPA based event store inside of a container (e.g. Payara or WildFly), you have to configure the following facilities:

Please see the examples for details.

Roadmap

The module currently does not support sagas, snapshoters and subscription queries. Such support will be added as soon as possible.

Known Issues

The following are the known issues with the extension. Please also look at our GitHub issue tracker.

  • We have tested but do not currently support GlassFish due to numerous critical bugs that have been fixed in GlassFish derivative Payara.
  • We have tested but do not currently support TomEE Plus due to OpenJPA issues that do not exist with TomEE Plume and EclipseLink.

Acknowledgements

The work for Axon to support CDI started in the community. The earliest CDI support for Axon came from the following folks:

A few other folks took this community-driven work a step much further by more closely aligning with newer versions of Axon:

The official Axon support for CDI is based on the collective hard work of these folks in the community. AxonIQ is very grateful to all direct and indirect community contributors to this module.

cdi's People

Contributors

felipe-alves-moraes avatar m-reza-rahman avatar m1l4n54v1c avatar marleinevankampen avatar

Watchers

 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.