orleans icon indicating copy to clipboard operation
orleans copied to clipboard

Loading StorageProvider Connection string from ServiceConfiguration in Azure worker role

Open ponsakthi opened this issue 11 years ago • 7 comments

Can Silo automatically load DataConnectionString for StorageProvider from ServiceConfiguration of a Worker role.

Instead of hardcoding it in OrleansConfiguration.xml like this,

<StorageProviders>
      <Provider Type="Orleans.Storage.AzureTableStorage" Name="AzureStore" DataConnectionString="<ConnectionString>" /> 
    </StorageProviders>

Is there any other way that it can take this Connection string from ServiceConfiguration of a Worker role as most of the connection string details are part of ServiceConfiguration file and I dont want to duplicate it and update this XML file during the deployment.

ponsakthi avatar Sep 17 '15 11:09 ponsakthi

Noting prevents the provider code from loading connection strings from service configuration. However, it would probably be best to generalize that somehow, so that the runtime will do that instead of each provider doing it on its own.

It's easy to put a variable name like to provider config. It is less clear to me how to make the runtime resolve it without taking a dependency on Azure libraries. Seems like we would need a resolver plugin to stay generic.

sergeybykov avatar Sep 17 '15 15:09 sergeybykov

@sergeybykov I think we have a good change to tackle these if @attilah (and whoever has the chance to help) champions the v1 of DI code.

veikkoeeva avatar Sep 17 '15 15:09 veikkoeeva

@veikkoeeva Good point.

sergeybykov avatar Sep 17 '15 16:09 sergeybykov

@ponsakthi , there is also a programmatic API now to specify/update provider configuration. So you do not have to duplicate the string in the config xml, you can update your provider config object in your role code, before starting the silo.

gabikliot avatar Sep 17 '15 16:09 gabikliot

Check this out - it does that exactly: https://github.com/dotnet/orleans/blob/master/Samples/AzureWebSample/OrleansAzureSilos/WorkerRole.cs#L76

gabikliot avatar Sep 17 '15 16:09 gabikliot

@ponsakthi, did it solve your problem?

gabikliot avatar Sep 18 '15 18:09 gabikliot

@gabikliot . Thanks it solved the problem

ponsakthi avatar Sep 19 '15 11:09 ponsakthi