Search in sources :

Example 1 with ContractDefinitionLoader

use of org.eclipse.dataspaceconnector.dataloading.ContractDefinitionLoader in project DataSpaceConnector by eclipse-dataspaceconnector.

the class CosmosContractDefinitionStoreExtension method initialize.

@Override
public void initialize(ServiceExtensionContext context) {
    var configuration = new CosmosContractDefinitionStoreConfig(context);
    var client = clientProvider.createClient(vault, configuration);
    var cosmosDbApi = new CosmosDbApiImpl(configuration, client);
    var store = new CosmosContractDefinitionStore(cosmosDbApi, context.getTypeManager(), (RetryPolicy<Object>) context.getService(RetryPolicy.class), configuration.getPartitionKey());
    context.registerService(ContractDefinitionStore.class, store);
    ContractDefinitionLoader loader = store::save;
    context.registerService(ContractDefinitionLoader.class, loader);
    context.getTypeManager().registerTypes(ContractDefinitionDocument.class);
    context.getService(HealthCheckService.class).addReadinessProvider(() -> cosmosDbApi.get().forComponent(name()));
}
Also used : HealthCheckService(org.eclipse.dataspaceconnector.spi.system.health.HealthCheckService) ContractDefinitionLoader(org.eclipse.dataspaceconnector.dataloading.ContractDefinitionLoader) CosmosDbApiImpl(org.eclipse.dataspaceconnector.azure.cosmos.CosmosDbApiImpl)

Aggregations

CosmosDbApiImpl (org.eclipse.dataspaceconnector.azure.cosmos.CosmosDbApiImpl)1 ContractDefinitionLoader (org.eclipse.dataspaceconnector.dataloading.ContractDefinitionLoader)1 HealthCheckService (org.eclipse.dataspaceconnector.spi.system.health.HealthCheckService)1