The entry point into a Simple Sourcing application is the EventSourcedApp DSL. With this you can:

  • Set the Kafka for configuration to specify how to interact with the Kafka cluster
  • Add one or more aggregates and wire in and their associated command and event handlers
  • Call the start method which starts the application

For example:

public static void main(final String[] args) {
    final AggregateSerdes<~> avroAggregateSerdes = ...;

    new EventSourcedApp()
        .withKafkaConfig(configBuilder -> configBuilder
        .<~>addAggregate(aggregateBuilder -> aggregateBuilder
                .withResourceNamingStrategy(new PrefixResourceNamingStrategy("user_avro_"))
                .withInitialValue((k) -> Optional.empty())
        .<~>addAggregate(aggregateBuilder -> ... /* another aggregate */ )

The application is now ready to receive commands published using the command API.