-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add options for elasticsearch synchronization (#487)
* Add options for elasticsearch synchronization * Change structure for elasticsearch settings * Change settings after solve conflicts after rebase * fix productivity Co-authored-by: Sergii Novytskyi <[email protected]>
- Loading branch information
1 parent
0d383dc
commit 66dd061
Showing
8 changed files
with
66 additions
and
14 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
OutOfSchool/OutOfSchool.WebApi/Config/ElasticsearchSynchronizationSchedulerConfig.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Microsoft.Extensions.Configuration; | ||
|
||
namespace OutOfSchool.WebApi.Config | ||
{ | ||
public class ElasticsearchSynchronizationSchedulerConfig | ||
{ | ||
public static string SectionName { get; } = ElasticConfig.Name + ConfigurationPath.KeyDelimiter + "SynchronizationScheduler"; | ||
|
||
public int OperationsPerTask { get; set; } | ||
|
||
public int DelayBetweenTasksInMilliseconds { get; set; } | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
OutOfSchool/OutOfSchool.WebApi/Extensions/ElasticsearchSynchronizationExtension.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Options; | ||
using OutOfSchool.WebApi.Config; | ||
using OutOfSchool.WebApi.Services; | ||
|
||
namespace OutOfSchool.WebApi.Extensions | ||
{ | ||
public static class ElasticsearchSynchronizationExtension | ||
{ | ||
public static IServiceCollection AddElasticsearchSynchronization( | ||
this IServiceCollection services, | ||
Action<OptionsBuilder<ElasticsearchSynchronizationSchedulerConfig>> elasticsearchSynchronizationSchedulerConfig) | ||
{ | ||
services.AddHostedService<ElasticsearchSynchronizationHostedService>(); | ||
services.AddTransient<IElasticsearchSynchronizationService, ElasticsearchSynchronizationService>(); | ||
if (elasticsearchSynchronizationSchedulerConfig == null) | ||
{ | ||
throw new ArgumentNullException(nameof(elasticsearchSynchronizationSchedulerConfig)); | ||
} | ||
|
||
var elasticsearchSynchronizationSchedulerConfigBuilder = services.AddOptions<ElasticsearchSynchronizationSchedulerConfig>(); | ||
elasticsearchSynchronizationSchedulerConfig(elasticsearchSynchronizationSchedulerConfigBuilder); | ||
return services; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,5 +76,3 @@ | |
|
||
"MySQLServerVersion": "8.0.27" | ||
} | ||
|
||
|