Axonframework: Pick up Aggregate Cache in (Spring Auto) Configuration

Created on 28 Aug 2019  路  3Comments  路  Source: AxonFramework/AxonFramework

This issue is successor of #642 as you did not implement point 2:
"Pick up caching mechanisms from spring application context and make them available in the configuration"
Using:

  • default Axon configuration
  • Spring Boot auto configuration feature
  • Cache implemetation in Spring context

Axon DefaultConfigurer does not use the Cache implementation, because AggregateConfigurer:

  • is not serching for cache inside existing Spring context
  • is not calling EventSourcingRepository.Builder.cache method at all.

I was thinking to add some code into AggregateConfigurer constructor. Someting like
cache = new Component<>(() -> parent, name("cache"), c -> c.getComponent(Cache.class, () -> null));
and then later in builder definition
EventSourcingRepository.Builder<A> builder = EventSourcingRepository.builder(aggregate).cache(cache)...;

Ideal for Contribution Could Resolved Feature

Most helpful comment

The description was updated as requested. Are there any questions left?

All 3 comments

Thanks for drafting up this issue @quaso.
Firstly, I would like to emphasize on the following in your response:

Thus framework does not support caching in its default configuration.

The default configuration of Axon, the Configuration API, is by definition not a Spring configuration set up. The Spring and Spring Boot modules should be regarded as extensions to the framework, albeit important ones.

I have just now adjusted the title of your issue, but I feel this still might be incorrect.
There are several levels the configuration of Caching for Aggregates (and Sagas) can be improved.

First and foremost, that will _always_ be the Configuration API, thus through the DefaultConfigurer/AggregateConfigurer/SagaConfigurer.
Second would come any kind of auto configuration, either through Spring or CDI.

Concluding, I would like to ask you to be more specific in the wording you have used.
Are you looking for Configuration API improvements?
Or are you hoping to have Spring Boot Auto Configuration in place when you create a Cache bean?

The more fine tuned the issue, the better anyone can pick this up within the community.
A contribution from your part would for example also be very welcome by the way @quaso!

Concluding, I want to ask you to update the title and it's description to specifically state what you are suggesting.

The description was updated as requested. Are there any questions left?

Very much appreciated @quaso, this makes it a lot clearer.
To be honest, I think providing a pull request for this would certainly be doable for somebody from the community.
Would you be up for the task? :-)

Was this page helpful?
0 / 5 - 0 ratings