我正在使用 axon 2.3.1 ,我有一个聚合类
public class MyAggregate extends AbstractAnnotatedAggregateRoot<MBAggregate> {
@AggregateIdentifier
private MyId Id;
private Circle circle;
EventDispatcher a=new EventDispatcher();
public MyAggregate() {
}
@CommandHandler
public MyAggregate(NewCommand command ) {
apply(new SmallEvent(command.getId(), command.getCircle()));
}
@CommandHandler
public MyAggregate( StoreDestinationsCommand command ) {
apply(new BigEvent(command.getId(), command.getCircle()));
}
//And some event handlers like
@EventHandler
public void onSmallEvent(SmallEvent event)
{
//Some logic here
}
@EventHandler
public void onBigEvent(BigEvent event)
{
//Some logic here
}
现在我希望这些事件处理程序包含在其他一些类中,并在该事件被触发时被调用
public class EventContainer {
private static final long serialVersionUID = -6640657879730853388L;
@EventHandler
public void onSmallEvent(SmallEvent event)
{
//Some logic here
}
@EventHandler
public void onBigEvent(BigEvent event)
{
//Some logic here
}
我尝试将它们放在另一个类中,但没有触发这些事件。
知道如何在 AXON 中实现这一点。
谢谢,