public static void main(String[] args) {
    // let's start with the Command Bus
    CommandBus commandBus = new SimpleCommandBus();

    // the CommandGateway provides a friendlier API to send commands
    CommandGateway commandGateway = new DefaultCommandGateway(commandBus);

    // we'll store Events on the FileSystem, in the "events" folder
    EventStore eventStore =
        new FileSystemEventStore(new SimpleEventFileResolver(new File("./events")));

    // a Simple Event Bus will do
    EventBus eventBus = new SimpleEventBus();

    // we need to configure the repository
    EventSourcingRepository<ToDoItem> repository =
        new EventSourcingRepository<>(ToDoItem.class, eventStore);
    repository.setEventBus(eventBus);

    // Axon needs to know that our ToDoItem Aggregate can handle commands
    new AggregateAnnotationCommandHandler<>(ToDoItem.class, repository).subscribe(commandBus);

    // We register an event listener to see which events are created
    eventBus.subscribe(
        new SimpleEventProcessor(
            "logging", new AnnotationEventListenerAdapter(new ToDoEventHandler())));

    // and let's send some Commands on the CommandBus.
    CommandGenerator.sendCommands(commandGateway);
  }
 @Bean
 Repository<TimesheetAR> timesheetARRepository(
     EventBus eventBus, SnapshotEventStore eventStore, SnapshotterTrigger snapshotterTrigger) {
   EventSourcingRepository<TimesheetAR> repository =
       new EventSourcingRepository<TimesheetAR>(timesheetAggregateFactory(), eventStore);
   repository.setEventBus(eventBus);
   repository.setSnapshotterTrigger(snapshotterTrigger);
   return repository;
 }
 @Before
 public void setUp() {
   repository = new EventSourcingRepository<StubAggregate>(StubAggregate.class);
   mockEventBus = mock(EventBus.class);
   mockEventStore = new StubEventStore();
   repository.setEventBus(mockEventBus);
   repository.setEventStore(mockEventStore);
   aggregateIdentifier = "testAggregateIdentifier";
 }
 @Before
 public void setUp() {
   mockEventStore = mock(SnapshotEventStore.class);
   mockEventBus = mock(EventBus.class);
   testSubject = new EventSourcingRepository<TestAggregate>(new SubtAggregateFactory());
   testSubject.setEventBus(mockEventBus);
   testSubject.setEventStore(mockEventStore);
   unitOfWork = DefaultUnitOfWork.startAndGet();
 }
 @Bean
 public EventSourcingRepository<SalesChannel> salesChannelRepository() {
   FileSystemEventStore eventStore =
       new FileSystemEventStore(new SimpleEventFileResolver(new File("data/eventstore")));
   EventSourcingRepository<SalesChannel> repository =
       new EventSourcingRepository<SalesChannel>(SalesChannel.class, eventStore);
   repository.setEventBus(eventBus());
   return repository;
 }