Hello
I was wondering if someone can help me with the following:
I have a commandhandler that is called using @CommandHandler annotation. When I use the Apply static method the event is not getting triggered. Debugging the framework it is failing in the following place
protected static AggregateLifecycle getInstance() {
AggregateLifecycle instance = CURRENT.get();
if (instance == null && CurrentUnitOfWork.isStarted()) {
UnitOfWork<?> unitOfWork = CurrentUnitOfWork.get();
Set<AggregateLifecycle> managedAggregates = unitOfWork.getResource("ManagedAggregates"); --> this is null
if (managedAggregates != null && managedAggregates.size() == 1) {
instance = managedAggregates.iterator().next();
}
}
if (instance == null) {
throw new IllegalStateException("Cannot retrieve current AggregateLifecycle; none is yet defined"); -->this is the error I am getting
}
return instance;
}
Could you please help me what I am doing wrong. The command and the event are very simple and are located in different files.
Richard