Just a quick question about best practices when using external command handler (not handling commands on the aggregate )
However, the java doc for “org.axonframework.commandhandling.model.Aggregate#execute” says:
/** * Execute a method on the underlying aggregate or one of its instances. * <p> * Note that the use of this method is not recommended as the wrapped aggregate instance is not meant to be * exposed. Relying on this method is commonly a sign of design smell. * * @param invocation The function that performs the invocation */ void execute(Consumer<T> invocation);
So my questions are:
- Is it ok to use “execute” everywhere as shown in the example projects, or should it be only used in certain scenarios and what are those scenarios, if any?
- If the JavaDoc is accurate then what is the preferred way of calling methods on your aggregate (assuming you still want to use a separate object for command handling)?
Thanks for your time