Skip to content

Commit

Permalink
FMWK-630 Add unique bean names for index creators (#811)
Browse files Browse the repository at this point in the history
  • Loading branch information
agrgr authored Dec 24, 2024
1 parent eaf2082 commit a7d9543
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ public AerospikeTemplate aerospikeTemplate(IAerospikeClient aerospikeClient,
AerospikeExceptionTranslator aerospikeExceptionTranslator,
QueryEngine queryEngine, IndexRefresher indexRefresher,
ServerVersionSupport serverVersionSupport,
AerospikeSettings settings) {
AerospikeSettings settings)
{
return new AerospikeTemplate(aerospikeClient, settings.getDataSettings().getNamespace(),
mappingAerospikeConverter, aerospikeMappingContext, aerospikeExceptionTranslator, queryEngine,
indexRefresher, serverVersionSupport);
Expand All @@ -55,7 +56,8 @@ public AerospikeTemplate aerospikeTemplate(IAerospikeClient aerospikeClient,
@Bean(name = "aerospikeQueryEngine")
public QueryEngine queryEngine(IAerospikeClient aerospikeClient,
StatementBuilder statementBuilder,
FilterExpressionsBuilder filterExpressionsBuilder, AerospikeSettings settings) {
FilterExpressionsBuilder filterExpressionsBuilder, AerospikeSettings settings)
{
QueryEngine queryEngine = new QueryEngine(aerospikeClient, statementBuilder, filterExpressionsBuilder,
settings.getDataSettings());
boolean scansEnabled = settings.getDataSettings().isScansEnabled();
Expand All @@ -72,11 +74,12 @@ public QueryEngine queryEngine(IAerospikeClient aerospikeClient,
return queryEngine;
}

@Bean
@Bean(name = "aerospikePersistenceEntityIndexCreator")
public AerospikePersistenceEntityIndexCreator aerospikePersistenceEntityIndexCreator(
ObjectProvider<AerospikeMappingContext> aerospikeMappingContext,
AerospikeIndexResolver aerospikeIndexResolver,
ObjectProvider<AerospikeTemplate> template, AerospikeSettings settings) {
ObjectProvider<AerospikeTemplate> template, AerospikeSettings settings)
{
boolean indexesOnStartup = settings.getDataSettings().isCreateIndexesOnStartup();
log.info("AerospikeDataSettings.indexesOnStartup: {}", indexesOnStartup);
return new AerospikePersistenceEntityIndexCreator(aerospikeMappingContext, indexesOnStartup,
Expand All @@ -85,7 +88,8 @@ public AerospikePersistenceEntityIndexCreator aerospikePersistenceEntityIndexCre

@Bean(name = "aerospikeIndexRefresher")
public IndexRefresher indexRefresher(IAerospikeClient aerospikeClient, IndexesCacheUpdater indexesCacheUpdater,
ServerVersionSupport serverVersionSupport, AerospikeSettings settings) {
ServerVersionSupport serverVersionSupport, AerospikeSettings settings)
{
IndexRefresher refresher = new IndexRefresher(aerospikeClient, aerospikeClient.getInfoPolicyDefault(),
new InternalIndexOperations(new IndexInfoParser()), indexesCacheUpdater, serverVersionSupport);
refresher.refreshIndexes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public ReactiveAerospikeTemplate reactiveAerospikeTemplate(MappingAerospikeConve
ReactorQueryEngine reactorQueryEngine,
ReactorIndexRefresher reactorIndexRefresher,
ServerVersionSupport serverVersionSupport,
AerospikeSettings settings) {
AerospikeSettings settings)
{
return new ReactiveAerospikeTemplate(aerospikeReactorClient, settings.getDataSettings().getNamespace(),
mappingAerospikeConverter, aerospikeMappingContext, aerospikeExceptionTranslator,
reactorQueryEngine, reactorIndexRefresher, serverVersionSupport);
Expand All @@ -65,7 +66,8 @@ public ReactiveAerospikeTemplate reactiveAerospikeTemplate(MappingAerospikeConve
public ReactorQueryEngine reactorQueryEngine(IAerospikeReactorClient aerospikeReactorClient,
StatementBuilder statementBuilder,
FilterExpressionsBuilder filterExpressionsBuilder,
AerospikeSettings settings) {
AerospikeSettings settings)
{
ReactorQueryEngine queryEngine = new ReactorQueryEngine(aerospikeReactorClient, statementBuilder,
filterExpressionsBuilder, settings.getDataSettings());
boolean scansEnabled = settings.getDataSettings().isScansEnabled();
Expand All @@ -85,7 +87,8 @@ public ReactorQueryEngine reactorQueryEngine(IAerospikeReactorClient aerospikeRe
@Bean(name = "reactiveAerospikeIndexRefresher")
public ReactorIndexRefresher reactorIndexRefresher(IAerospikeReactorClient aerospikeReactorClient,
IndexesCacheUpdater indexesCacheUpdater,
ServerVersionSupport serverVersionSupport) {
ServerVersionSupport serverVersionSupport)
{
ReactorIndexRefresher refresher = new ReactorIndexRefresher(aerospikeReactorClient,
aerospikeReactorClient.getInfoPolicyDefault(),
new InternalIndexOperations(new IndexInfoParser()), indexesCacheUpdater, serverVersionSupport);
Expand All @@ -105,11 +108,12 @@ protected ClientPolicy getClientPolicy() {
return clientPolicy;
}

@Bean
public ReactiveAerospikePersistenceEntityIndexCreator aerospikePersistenceEntityIndexCreator(
@Bean(name = "reactiveAerospikePersistenceEntityIndexCreator")
public ReactiveAerospikePersistenceEntityIndexCreator aerospikeReactivePersistenceEntityIndexCreator(
ObjectProvider<AerospikeMappingContext> aerospikeMappingContext,
AerospikeIndexResolver aerospikeIndexResolver,
ObjectProvider<ReactiveAerospikeTemplate> template, AerospikeSettings settings) {
ObjectProvider<ReactiveAerospikeTemplate> template, AerospikeSettings settings)
{
boolean indexesOnStartup = settings.getDataSettings().isCreateIndexesOnStartup();
log.info("AerospikeDataSettings.indexesOnStartup: {}", indexesOnStartup);
return new ReactiveAerospikePersistenceEntityIndexCreator(aerospikeMappingContext,
Expand Down

0 comments on commit a7d9543

Please sign in to comment.