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()));
}
Aggregations