Hi,
In Axon 2 i used to inject parameters in @SagaEventHandlers methods, for example:
@SagaEventHandler(associationProperty = “someId”)
public void onSomethingHappened(SomethingHappened event, Service service) {
service.call(…);
// other stuff
}
Using Axon 3 i cannot get this to work in my SagaTestFixture:
fixture = new SagaTestFixture<>(TestSaga.class);
fixture.registerResource(service);
When running the test, it will complain that the resource is not registered.
If i use a private transient field with a setter annotated with @Inject it will inject the service just fine, but i would prefer to use ‘old’ way of passing my resources. This also prevents me from having to include the inject jar, since i’m using springg’s @Autowired for everything else.
I’m using the same approach for aggregates and those tests can find the resources just fine (without the private fields with setter).
Can the same be done for sagas?
Greets Rolf