Search in sources :

Example 1 with FederatedCacheNodeDirectory

use of org.eclipse.dataspaceconnector.catalog.spi.FederatedCacheNodeDirectory in project DataSpaceConnector by eclipse-dataspaceconnector.

the class CosmosFederatedCacheNodeDirectoryExtension method initialize.

@Override
public void initialize(ServiceExtensionContext context) {
    var configuration = new FederatedCacheNodeDirectoryCosmosConfig(context);
    var cosmosDbApi = new CosmosDbApiImpl(configuration, clientProvider.createClient(vault, configuration));
    FederatedCacheNodeDirectory directory = new CosmosFederatedCacheNodeDirectory(cosmosDbApi, configuration.getPartitionKey(), context.getTypeManager(), context.getService(RetryPolicy.class));
    context.registerService(FederatedCacheNodeDirectory.class, directory);
    context.getTypeManager().registerTypes(FederatedCacheNodeDocument.class);
    context.getService(HealthCheckService.class).addReadinessProvider(() -> cosmosDbApi.get().forComponent(name()));
}
Also used : HealthCheckService(org.eclipse.dataspaceconnector.spi.system.health.HealthCheckService) FederatedCacheNodeDirectory(org.eclipse.dataspaceconnector.catalog.spi.FederatedCacheNodeDirectory) RetryPolicy(net.jodah.failsafe.RetryPolicy) CosmosDbApiImpl(org.eclipse.dataspaceconnector.azure.cosmos.CosmosDbApiImpl)

Aggregations

RetryPolicy (net.jodah.failsafe.RetryPolicy)1 CosmosDbApiImpl (org.eclipse.dataspaceconnector.azure.cosmos.CosmosDbApiImpl)1 FederatedCacheNodeDirectory (org.eclipse.dataspaceconnector.catalog.spi.FederatedCacheNodeDirectory)1 HealthCheckService (org.eclipse.dataspaceconnector.spi.system.health.HealthCheckService)1