The Eventuate client framework for Java and Spring

The Eventuate client framework enables you to write Eventuate applications using Java and Spring. It provides interfaces, classes and annotations for writing your application components.

Event types

The client framework provides the following types for defining event classes:

  • Event interface - a super interface for events
  • @EventEntity annotation - an annotation that specifies the entity type name for an event

Aggregate types

The client framework provides a couple of different types that you can use to implement aggregates.

An aggregate must implement the CommandProcessingAggregate interface, which defines two methods:

  • processCommand() - takes a command object derived from an update request and returns a sequence of events
  • applyEvent() - takes an event and returns an updated aggregate The applyEvent() method is invoked when processing a request to update the state to reflect the new events. This method is also called when an entity’s current state reconstituted by loading its events from the Event Store and replaying them.

Instead of implementing this interface directly, an aggregate can extend the ReflectiveMutableCommandProcessingAggregate superclass. This class extends CommandProcessingAggregate and implements processCommand() and applyEvent() using reflection. The processCommand() method calls the appropriate process() based on the command type. Similarly, the applyEvent() method calls the appropriate apply() method based on the event type.

Command types

The client framework provides the following types for defining commands:

  • Command interface - a superinterface for all commands

Service types

The client framework provides the follow types for writing command-side services:

  • AggregateRepository - defines methods for creating and updating aggregates. It is a helper class that hides the boilerplate code that you would otherwise need to write to use the event store.

Command-side event handler types

The client framework provides several types for writing command-side event handlers:

  • @EventSubscriber - an annotation that identifies a Spring bean as an event handler
  • @EventHandlerMethod - an annotation that identifies a method as an event handler method
  • EventHandlerContext - the parameter type for command-side event handler methods. It provides access to the event and defines methods for creating and updating aggregates.

Query-side component and outbound gateway event handler types

The client framework provides several types for writing event handlers for query side components and outbound gateways:

  • @EventSubscriber - an annotation that identifies a Spring bean as an event handler
  • @EventHandlerMethod - an annotation that identifies a method as an event handler method
  • DispatchedEvent - the parameter type for query-side and outbound gateway event handler methods. It provides access to the event.

Configuration types

The client framework provides the following types for configuring your Spring application context:

  • @EnableEventHandlers - an annotation for @Configuration classes that enables the automatic registration of your @EventSubscribers
  • EventuateHttpStompClientConfiguration - an @Configuration class that you @Import in order to configure the Eventuate HTTP/STOMP-based client
  • EventuateJdbcEventStoreConfiguration - an @Configuration class that you @Import in order to configure the embedded test event store *

Stay in touch
Copyright © 2021 Eventuate, Inc • All rights reserved.