AxonFramework icon indicating copy to clipboard operation
AxonFramework copied to clipboard

AggregateBasedAxonServerEventStorageEngine returns invalid AggregateSequence

Open dilgerma opened this issue 7 months ago • 0 comments

Basic information

  • Axon Framework version: 5.1.0-RC2
  • JDK version: 25
  • Complete executable reproducer if available (e.g. GitHub Repo):

Steps to reproduce

Configure Aggregatebased EventStorage Engine

@Bean
    public EventStorageEngine storageEngine(AxonServerConnectionManager connectionManager,
                                            EventConverter eventConverter) {
        return new AggregateBasedAxonServerEventStorageEngine(
                connectionManager.getConnection(),
                eventConverter
        );
    }

Define an Event Sourced Entity:

public record RegisterBikeCommand(
        @TargetEntityId String bikeId,
        String bikeType,
        String location
) {}

@Event
public record BikeRegisteredEvent(@EventTag String bikeId, String bikeType, String location) {}
@EventSourced(tagKey = "bikeId")
public class Bike {

    // identifier
    private String bikeId;

    @CommandHandler
    public static void handle(RegisterBikeCommand command, EventAppender eventAppender) {
       eventAppender.append(new BikeRegisteredEvent(command.bikeId(), command.bikeType(), command.location()));
    }

    @EntityCreator
    public Bike(BikeRegisteredEvent event) {
        this.bikeId = event.bikeId();
    }

}

Expected behaviour

Should appened the event to an empty Event Store. Results in Conflict.

Actual behaviour

Results in a Conflict ( tried Axon Server 2025.2.0 and 2026 )

org.axonframework.messaging.commandhandling.CommandExecutionException: org.axonframework.eventsourcing.eventstore.AppendEventsTransactionRejectedException: Event matching append criteria have been detected beyond provided consistency marker: AggregateBasedConsistencyMarker{aggregatePositions={5a24c842-3f9a-4730-9f1d-cbc25064164b=1}}
	Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
Error has been observed at the following site(s):
	*__checkpoint ⇢ Handler io.axoniq.demo.bikerental.ui.RentalController#generateBikes(String) [DispatcherHandler]
	*__checkpoint ⇢ HTTP POST "/?bikeType=city" [ExceptionHandlingWebHandler]
Original Stack Trace:
Caused by: org.axonframework.axonserver.connector.command.AxonServerRemoteCommandHandlingException: An exception was thrown by the remote message handling component: 

dilgerma avatar Apr 20 '26 11:04 dilgerma