Thanks to Yevhen Bobrov for pointing this out.
The default behavior of an Orleans system is to respond to external signals. Your grains are activated when required, so with no requests coming into the system, nothing happens. The bootstrap provider enables you to hook in some code at silo startup. There are a variety of reasons for doing this, perhaps you want to set some local grains up, or initialize some data. The Hub design pattern makes use of the bootstrap provider create a stateless worker in each Silo.
Creating a bootstrap provider is simple, just inherit IBootstrapProvider
and implement the members. Put your code in Init
, which is of course asynchronous.
Then register your provider in the BootstrapProviders
section of OrleansConfiguration.xml
:
Like other providers, any additional attributes you add to the Provider
tag will be presented in the IProviderConfiguration
parameter on Init
.
If your provider throws an exception, the silo will fail to start.
Simple!