First, what’s the ‘KeyStore’ you’re referring too? Not Axon’s ‘TokenStore’ I assume?
Second, I do not fully comprehend what you’re trying to achieve exactly, but I can tell you I’d advice against wiring the
CommandBus in your Aggregate.
CommandBus means you’re gonna publish commands on event sourcing an event, thus meaning you’re gonna lock another aggregate from handling commands; you’d thus introduce a blocking call in handling commands/events in your aggregate, something you should always try to avoid to increase the performance of your Aggregate.
EventStore to me suggest you’re either gonna publish more events or you’re gonna query an event stream. For the first you should always use the ‘AggregateLifecycle.apply()’ function in your aggregate and the latter is again a blocking call as you’re pulling events from a database.
If you want to react on events like your
UnitAdjustmentEvent (which I suggest renaming to
UnitAdjustedEvent, to point out it has happened), you can simply introduce a class with
@EventHandler annotated function for the event you’re interested in.
On handling that event, you can then update the View you’re talking about.
I hope this gives you some insights Gerry.
If I’m however reading your question incorrectly, feel free to clarify.