Troubles invoking operations on aggregate

When I call save method to persist an aggreate the corresponding event
handler is firing correctly. Otherwise, when I load an aggregate from
the repository and call an operation on it, nothing happens. Here is
my code.

public class MarketCommandHandler {

  private Repository<Market> marketRepository;

  public Repository<Market> getMarketRepository() {
    return marketRepository;

  public void setMarketRepository(Repository<Market> marketRepository)
    this.marketRepository = marketRepository;

  public void changeMarketName(ChangeMarketNameCommand
changeMarketNameCommand) {

    Market market =
market.changeMarketName( changeMarketNameCommand.getNewMarketName() );


In changeMarketName i have this:

public void changeMarketName(String newMarketName) {
  apply( new MarketNameChangedEvent(newMarketName) );

The event handler which is defined inside the Market aggregate is

I'm wiring command and event handlers using a BeanPostProcessor
classes in the application context. I'm using
GenericEventSourcingRepository implementation and file system event

Hi Nedo,

I assume you are using 0.6?
You could try wiring a UnitOfWorkInterceptor on your CommandBus (which is no longer needed from 0.7 onwards). That should take care of the actual dispatching of the events if you don’t explicitly call save on your aggregate. Since you’re using the FileSystemEventStore, the SimpleUnitOfWorkInterceptor should do the trick.

In the 0.6 version, you should either call save() explicitly on aggregates or use a UnitOfWorkInterceptor (e.g. SimpleUnitOfWorkInterceptor, SpringTransactionalInterceptor, etc). In the 0.7 version, the UnitOfWork is started automatically on the command bus. So explicit wiring of an interceptor won’t be required anymore.

Hope this helps.


Allard Buijze

Thanks Allard.

Calling and passing the aggregate result in
invocation of an event handler.

Btw. when I try to download the version 0.7 I got the following error

The server has not found anything matching the request URI

Cheers =)

Thanks for pointing that problem out. I fixed the links. They don’t point to the download directly, unfortunately, but to the maven repository. I’ll see if I can fix that, too.