Hi there,
I’ve stumbled on a problem with Axon. I have a CommandHandler on an aggregate that receives two the parameters. The first parameter, obviously is the command, and the second parameter is an EventStore. So the signature basically looks like this:
`
@CommandHandler
public void handle(AssignRight command, EventStore eventStore) {
}
`
I’m using this in a unit test with a default configuration like this:
`
EventStorageEngine eventStorageEngine = new InMemoryEventStorageEngine();
Configuration configuration = DefaultConfigurer
.defaultConfiguration()
.configureEmbeddedEventStore(config -> eventStorageEngine)
.configureAggregate(Role.class)
.buildConfiguration();
configuration.start();
`
When I now send a command to the aggregate with this:
`
configuration.commandGateway().sendAndWait(
assignRight
);
`
I get the following exception:
`
org.axonframework.test.FixtureExecutionException: No resource of type [org.axonframework.eventsourcing.eventstore.EventStore] has been registered. It is required for one of the handlers being executed.
at org.axonframework.test.FixtureResourceParameterResolverFactory$FailingParameterResolver.resolveParameterValue(FixtureResourceParameterResolverFactory.java:58)
at org.axonframework.messaging.annotation.AnnotatedMessageHandlingMember.resolveParameterValues(AnnotatedMessageHandlingMember.java:151)
at org.axonframework.messaging.annotation.AnnotatedMessageHandlingMember.handle(AnnotatedMessageHandlingMember.java:127)
at org.axonframework.messaging.annotation.WrappedMessageHandlingMember.handle(WrappedMessageHandlingMember.java:61)
at org.axonframework.commandhandling.model.inspection.AnnotatedAggregate.lambda$handle$3(AnnotatedAggregate.java:220)
at org.axonframework.commandhandling.model.inspection.AnnotatedAggregate$$Lambda$150/1538399081.call(Unknown Source)
at org.axonframework.commandhandling.model.AggregateLifecycle.executeWithResult(AggregateLifecycle.java:167)
at org.axonframework.commandhandling.model.inspection.AnnotatedAggregate.handle(AnnotatedAggregate.java:218)
at org.axonframework.commandhandling.model.LockAwareAggregate.handle(LockAwareAggregate.java:82)
…
`
So obviously there is no EventStore registered in the resources list.
If I use the type EventBus for the second parameter, the parameter gets injected into the command handler. So did I miss some concept that forbids the use on an EventStore by an aggregates command handler? Or is this a bug?
Help’s appreciated.
Thanks in advance,
Frank.