public static ISiloBuilder UseSignalR(this ISiloBuilder builder, Action <OrleansSignalRSiloOptions> configure = null) { var siloOptions = new OrleansSignalRSiloOptions(); configure?.Invoke(siloOptions); builder.AddSimpleMessageStreamProvider(OrleansSignalRConstants.StreamProviderName, options => { options.FireAndForgetDelivery = siloOptions.FireAndForgetDelivery; }); if (siloOptions.AddApplicationParts) { builder.ConfigureApplicationParts(manager => { manager.AddApplicationPart(typeof(ClientGrain).Assembly).WithReferences(); }); } if (siloOptions.RegisterDefaultSignalRGrainStorage) { builder.AddMemoryGrainStorage(OrleansSignalRConstants.StorageProviderName); } if (siloOptions.RegisterDefaultPubSubStorage) { builder.AddMemoryGrainStorage("PubSubStore"); } return(builder); }
public void Configure(ISiloBuilder hostBuilder) { // Do use "PubSubStore" in this test hostBuilder.AddMemoryStreams <DefaultMemoryMessageBodySerializer>(StreamProviderName); hostBuilder.AddMemoryGrainStorage(StreamProviderName); hostBuilder.AddMemoryStreams <DefaultMemoryMessageBodySerializer>(StreamProviderName2); hostBuilder.AddMemoryGrainStorage(StreamProviderName2); }
private static void SetStorage(ISiloBuilder silo) { if (OrleansConfig.MongoDB.Enable) { silo.AddMongoDBGrainStorageAsDefault(op => { op.Configure(ooop => { ooop.DatabaseName = OrleansConfig.MongoDB.DatabaseName + "_defaultgrain"; ooop.CreateShardKeyForCosmos = OrleansConfig.MongoDB.CreateShardKeyForCosmos; ooop.ConfigureJsonSerializerSettings = settings => { settings.NullValueHandling = NullValueHandling.Include; settings.ObjectCreationHandling = ObjectCreationHandling.Replace; settings.DefaultValueHandling = DefaultValueHandling.Populate; }; }); }); silo.AddMongoDBGrainStorage(GrainStorageKey.MongoDBStore, op => { op.Configure(ooop => { ooop.DatabaseName = OrleansConfig.MongoDB.DatabaseName + "_grain"; ooop.CreateShardKeyForCosmos = OrleansConfig.MongoDB.CreateShardKeyForCosmos; ooop.ConfigureJsonSerializerSettings = settings => { settings.NullValueHandling = NullValueHandling.Include; settings.ObjectCreationHandling = ObjectCreationHandling.Replace; settings.DefaultValueHandling = DefaultValueHandling.Populate; }; }); }); } else { silo.AddMemoryGrainStorage(GrainStorageKey.MongoDBStore); } if (OrleansConfig.Redis.Enable) { silo.AddRedisGrainStorage(GrainStorageKey.RedisStore, optionsBuilder => optionsBuilder.Configure(options => { options.DataConnectionString = $"{OrleansConfig.Redis.HostName}:{OrleansConfig.Redis.Port}"; options.UseJson = OrleansConfig.Redis.UseJson; options.DatabaseNumber = OrleansConfig.Redis.DatabaseNumber; })); } else { silo.AddMemoryGrainStorage(GrainStorageKey.RedisStore); } }
public void Configure(ISiloBuilder hostBuilder) { hostBuilder .AddEventHubStreams(StreamProviderName, b => { b.ConfigureEventHub(ob => ob.Configure(options => { options.ConfigureTestDefaults(EHPath, EHConsumerGroup); })); b.UseAzureTableCheckpointer(ob => ob.Configure(options => { options.ConfigureTableServiceClient(TestDefaultConfiguration.DataConnectionString); options.PersistInterval = TimeSpan.FromSeconds(10); })); b.ConfigureStreamPubSub(StreamPubSubType.ImplicitOnly); }); hostBuilder .AddEventHubStreams(StreamProviderName2, b => { b.ConfigureEventHub(ob => ob.Configure(options => { options.ConfigureTestDefaults(EHPath2, EHConsumerGroup); })); b.UseAzureTableCheckpointer(ob => ob.Configure(options => { options.ConfigureTableServiceClient(TestDefaultConfiguration.DataConnectionString); options.PersistInterval = TimeSpan.FromSeconds(10); })); b.ConfigureStreamPubSub(StreamPubSubType.ImplicitOnly); }); hostBuilder .AddMemoryGrainStorage("PubSubStore"); }
public void Configure(ISiloBuilder hostBuilder) { hostBuilder .AddMemoryGrainStorage("PubSubStore") .AddEventHubStreams(StreamProviderName, b => { b.ConfigureEventHub(ob => ob.Configure(options => { options.ConfigureTestDefaults(); options.ConsumerGroup = EHConsumerGroup; options.Path = EHPath; })); b.UseAzureTableCheckpointer(ob => ob.Configure(options => { options.ConnectionString = TestDefaultConfiguration.DataConnectionString; options.PersistInterval = TimeSpan.FromSeconds(10); })); b.ConfigurePullingAgent(ob => ob.Configure(options => { // sets up batching in the pulling agent options.BatchContainerBatchSize = 10; })); b.UseDynamicClusterConfigDeploymentBalancer(); }); }
public static ISiloBuilder UseAppConfiguration(this ISiloBuilder siloHost, AppSiloBuilderContext context) { var appInfo = context.AppInfo; siloHost .AddMemoryGrainStorage(OrleansConstants.GrainMemoryStorage) .Configure <ClusterOptions>(options => { options.ClusterId = appInfo.ClusterId; options.ServiceId = appInfo.Name; }); if (context.HostBuilderContext.HostingEnvironment.IsDevelopment()) { siloHost.UseDevelopment(context); } if (appInfo.IsDockerized) { siloHost.UseDockerSwarm(context); } else { siloHost.UseDevelopmentClustering(context); } return(siloHost); }
protected override ISiloBuilder PreBuild(ISiloBuilder builder) { OrleansFixture.GetAccountInfo(out var accountEndpoint, out var accountKey); var httpHandler = new HttpClientHandler() { ServerCertificateCustomValidationCallback = (req, cert, chain, errors) => true }; var dbClient = new CosmosClient( accountEndpoint, accountKey, new CosmosClientOptions { ConnectionMode = ConnectionMode.Gateway } ); return(builder .AddMemoryGrainStorage(OrleansFixture.TEST_STORAGE) .UseCosmosDBReminderService(opt => { opt.Client = dbClient; opt.CanCreateResources = true; opt.DB = DatabaseName; })); }
public void Configure(ISiloBuilder hostBuilder) => hostBuilder.AddMemoryGrainStorage("PubSubStore") .AddMemoryStreams <DefaultMemoryMessageBodySerializer>(StreamBatchingTestConst.ProviderName, b => { b.ConfigurePartitioning(partitionCount); b.ConfigurePullingAgent(ob => ob.Configure(options => options.BatchContainerBatchSize = 10)); b.ConfigureStreamPubSub(StreamPubSubType.ImplicitOnly); });
public static ISiloBuilder UseStorage(this ISiloBuilder siloBuilder, string storeProviderName, IAppInfo appInfo, StorageProviderType?storageProvider = null, string storeName = null) { storeName = storeName.IfNullOrEmptyReturn(storeProviderName); storageProvider ??= _defaultProviderType; switch (storageProvider) { case StorageProviderType.Memory: siloBuilder.AddMemoryGrainStorage(storeProviderName); break; case StorageProviderType.Redis: siloBuilder .AddRedisGrainStorage(storeProviderName) .Build(builder => builder.Configure(ConfigureRedisOptions(storeName, appInfo)) ); break; default: throw new ArgumentOutOfRangeException(nameof(storageProvider), $"Storage provider '{storageProvider}' is not supported."); } return(siloBuilder); }
public void Configure(ISiloBuilder hostBuilder) { hostBuilder .AddMemoryGrainStorage("MemoryStore", options => options.NumStorageGrains = 1) .AddAzureTableGrainStorage("AzureStore", builder => builder.Configure <IOptions <ClusterOptions> >((options, silo) => { options.ConfigureTestDefaults(); options.DeleteStateOnClear = true; })) .AddSimpleMessageStreamProvider(SmsStreamProviderName) .AddSimpleMessageStreamProvider("SMSProviderDoNotOptimizeForImmutableData", options => options.OptimizeForImmutableData = false) .AddAzureTableGrainStorage("PubSubStore", builder => builder.Configure <IOptions <ClusterOptions> >((options, silo) => { options.DeleteStateOnClear = true; options.ConfigureTestDefaults(); })) .AddAzureQueueStreams(AzureQueueStreamProviderName, b => b .ConfigureAzureQueue(ob => ob.Configure <IOptions <ClusterOptions> >( (options, dep) => { options.ConfigureTestDefaults(); options.QueueNames = AzureQueueUtilities.GenerateQueueNames(dep.Value.ClusterId, queueCount); }))); hostBuilder .AddAzureQueueStreams("AzureQueueProvider2", b => b .ConfigureAzureQueue(ob => ob.Configure <IOptions <ClusterOptions> >( (options, dep) => { options.ConfigureTestDefaults(); options.QueueNames = AzureQueueUtilities.GenerateQueueNames($"{dep.Value.ClusterId}2", queueCount); }))); }
public void Configure(ISiloBuilder hostBuilder) { hostBuilder .AddMemoryGrainStorage("PubSubStore") .AddEventHubStreams(StreamProviderName, b => { b.ConfigureCacheEviction(ob => ob.Configure(options => { options.DataMaxAgeInCache = TimeSpan.FromSeconds(5); options.DataMinTimeInCache = TimeSpan.FromSeconds(0); options.MetadataMinTimeInCache = TimeSpan.FromMinutes(1); })); b.ConfigureEventHub(ob => ob.Configure(options => { options.ConnectionString = TestDefaultConfiguration.EventHubConnectionString; options.ConsumerGroup = EHConsumerGroup; options.Path = EHPath; })); b.UseAzureTableCheckpointer(ob => ob.Configure(options => { options.ConnectionString = TestDefaultConfiguration.DataConnectionString; options.PersistInterval = TimeSpan.FromSeconds(10); })); b.UseDataAdapter((sp, n) => ActivatorUtilities.CreateInstance <CustomDataAdapter>(sp)); }); }
public void Configure(ISiloBuilder hostBuilder) => hostBuilder .AddMemoryGrainStorage("PubSubStore") .AddMemoryStreams <DefaultMemoryMessageBodySerializer>( StreamProviderName, b => b.ConfigurePartitioning(partitionCount)) .Configure <SiloMessagingOptions>(options => options.ClientDropTimeout = TimeSpan.FromSeconds(5));
public static ISiloBuilder MorsteadGrainStorage(this ISiloBuilder builder, Action <MorsteadStorageConfiguration> configure, IConfiguration configuration) { var config = new MorsteadStorageConfiguration(); configure(config); var connectionString = configuration["MorsteadStorage:ConnectionString"]; if (connectionString is null) { builder.AddMemoryGrainStorage(config.Name); return(builder); } builder.AddAzureBlobGrainStorage( name: config.Name, configureOptions: options => { //options.TableName = config.Name.ToLower().Replace("-", ""); options.ContainerName = config.Name.ToLower(); // Use JSON for serializing the state in storage //options.UseFullAssemblyNames = true; options.UseJson = true; options.ConnectionString = configuration["MorsteadStorage:ConnectionString"]; }); return(builder); }
public void Configure(ISiloBuilder hostBuilder) { hostBuilder .AddMemoryGrainStorage("PubSubStore") .AddSqsStreams(SQSStreamProviderName, (Action <Orleans.Configuration.SqsOptions>)(options => { options.ConnectionString = AWSTestConstants.SqsConnectionString; })); }
public void Configure(ISiloBuilder hostBuilder) { hostBuilder .AddMemoryGrainStorage("PubSubStore") .AddSqsStreams(SQSStreamProviderName, options => { options.ConnectionString = AWSTestConstants.DefaultSQSConnectionString; }); }
public void Configure(ISiloBuilder hostBuilder) { hostBuilder .AddMemoryGrainStorage("PubSubStore") .AddPubSubStreams <PubSubDataAdapter>(PROVIDER_NAME, options => { options.ProjectId = GoogleTestUtils.ProjectId; options.TopicId = GoogleTestUtils.TopicId; options.Deadline = TimeSpan.FromSeconds(600); }); }
public void Configure(ISiloBuilder hostBuilder) { hostBuilder .AddMemoryGrainStorage("PubSubStore") .AddAzureQueueStreams(AQStreamProviderName, ob => ob.Configure <IOptions <ClusterOptions> >( (options, dep) => { options.ConnectionString = TestDefaultConfiguration.DataConnectionString; options.QueueNames = AzureQueueUtilities.GenerateQueueNames(dep.Value.ClusterId, queueCount); })); }
public static ISiloBuilder UseSignalR(this ISiloBuilder builder, Action <SignalrOrleansSiloConfigBuilder> configure = null) { var cfg = new SignalrOrleansSiloConfigBuilder(); configure?.Invoke(cfg); cfg.ConfigureBuilder?.Invoke(builder, new HostBuilderConfig()); try { builder.AddMemoryGrainStorage(Constants.PUBSUB_PROVIDER); } catch { /** PubSubStore was already added. Do nothing. **/ } try { builder.AddMemoryGrainStorage(Constants.STORAGE_PROVIDER); } catch { /** Grain storage provider was already added. Do nothing. **/ } builder.ConfigureServices(services => services.AddSingleton <IConfigurationValidator, SignalRConfigurationValidator>()); return(builder .AddSimpleMessageStreamProvider(Constants.STREAM_PROVIDER, opt => opt.FireAndForgetDelivery = cfg.UseFireAndForgetDelivery) .ConfigureApplicationParts(parts => parts.AddApplicationPart(typeof(ClientGrain).Assembly).WithReferences())); }
/// <summary> /// Adds the OrgnalR grains to the builder, and also automatically registers memory grain storage for group and user lists. /// This is useful for local development, however it is recommended that you add a persistent storage for: /// <see cref="GROUP_STORAGE_PROVIDER"/>, and <see cref="USER_STORAGE_PROVIDER"/>, and <see cref="MESSAGE_STORAGE_PROVIDER"/> /// Then you may use <see cref="AddOrgnalR<T>(T builder)"/> to add orgnalr using the storage providers of your choice /// </summary> /// <param name="builder">The builder to configure</param> /// <returns>The silo builder, configured with memory storage and grains for the OrgnalR backplane</returns> public static ISiloBuilder AddOrgnalRWithMemoryGrainStorage(this ISiloBuilder builder, Action <OrgnalRSiloConfig>?configure = null) { try { builder.AddMemoryGrainStorage(Constants.GROUP_STORAGE_PROVIDER); } catch { /* Do nothing, already added */ } try { builder.AddMemoryGrainStorage(Constants.USER_STORAGE_PROVIDER); } catch { /* Do nothing, already added */ } try { builder.AddMemoryGrainStorage(Constants.MESSAGE_STORAGE_PROVIDER); } catch { /* Do nothing, already added */ } return(builder.AddOrgnalR(configure)); }
public void Configure(ISiloBuilder hostBuilder) { hostBuilder .AddMemoryGrainStorage("MemoryStore") .ConfigureServices(services => { services.AddSingleton <ErrorInjectionStorageProvider>(); services.AddSingletonNamedService <IGrainStorage, ErrorInjectionStorageProvider>("ErrorInjector"); services.AddSingletonNamedService <IControllable, ErrorInjectionStorageProvider>("ErrorInjector"); }); }
public void Configure(ISiloBuilder hostBuilder) { hostBuilder .AddMemoryGrainStorage("PubSubStore") .AddMemoryStreams <DefaultMemoryMessageBodySerializer>( StreamProviderName, b => { b.ConfigurePartitioning(totalQueueCount); b.ConfigurePartitionBalancing((s, n) => ActivatorUtilities.CreateInstance <LeaseBasedQueueBalancerForTest>(s, n)); }); }
public void Configure(ISiloBuilder hostBuilder) { hostBuilder .AddAzureQueueStreams(StreamTestsConstants.AZURE_QUEUE_STREAM_PROVIDER_NAME, b => b.ConfigureAzureQueue(ob => ob.Configure <IOptions <ClusterOptions> >((options, dep) => { options.ConnectionString = TestDefaultConfiguration.DataConnectionString; options.QueueNames = Enumerable.Range(0, 8).Select(num => $"{dep.Value.ClusterId}-{num}").ToList(); }))); hostBuilder.AddMemoryGrainStorage("PubSubStore"); }
private static ISiloBuilder UseDevelopment(this ISiloBuilder siloHost, AppSiloBuilderContext context) { siloHost .AddMemoryGrainStorage(OrleansConstants.PubSubStore) .ConfigureServices(services => { //services.Configure<GrainCollectionOptions>(options => { options.CollectionAge = TimeSpan.FromMinutes(1.5); }); }) .Configure <ClusterMembershipOptions>(options => options.ExpectedClusterSize = 1); return(siloHost); }
public void Configure(ISiloBuilder hostBuilder) { hostBuilder .AddMemoryGrainStorage("PubSubStore") .AddMemoryStreams <DefaultMemoryMessageBodySerializer>(StreamProviderName, b => { b.ConfigureCacheEviction(ob => ob.Configure(options => { options.DataMaxAgeInCache = TimeSpan.FromSeconds(5); options.DataMinTimeInCache = TimeSpan.FromSeconds(0); })); }); }
public void Configure(ISiloBuilder hostBuilder) { hostBuilder .AddMemoryGrainStorage("MemoryStore", op => op.NumStorageGrains = 1) .AddMemoryGrainStorage("PubSubStorage") .AddSimpleMessageStreamProvider("SMSProvider") .AddPubSubStreams <PubSubDataAdapter>(PUBSUB_STREAM_PROVIDER_NAME, b => b.ConfigurePubSub(ob => ob.Configure(options => { options.ProjectId = GoogleTestUtils.ProjectId; options.TopicId = GoogleTestUtils.TopicId; options.Deadline = TimeSpan.FromSeconds(600); }))); }
public static void AddPubSub(this ISiloBuilder siloBuilder) { siloBuilder.AddPlacementDirector <LocalPlacementStrategy, LocalPlacementDirector>(); siloBuilder.ConfigureServices(services => { services.AddSingleton <OrleansStreamingPubSub>(); services.AddSingleton <IPubSub>(c => c.GetRequiredService <OrleansStreamingPubSub>()); }); siloBuilder.AddSimpleMessageStreamProvider(Constants.StreamProviderName); siloBuilder.AddMemoryGrainStorage("PubSubStore"); siloBuilder.AddStartupTask <OrleansStreamingPubSub>(); }
public void Configure(ISiloBuilder hostBuilder) { hostBuilder .AddMemoryGrainStorage("PubSubStore") .AddEventDataGeneratorStreams( StreamProviderName, b => { b.Configure <EventDataGeneratorStreamOptions>(ob => ob.Configure( options => { options.EventHubPartitionCount = TotalQueueCount; })); b.ConfigurePartitionBalancing((s, n) => ActivatorUtilities.CreateInstance <LeaseBasedQueueBalancerForTest>(s, n)); }); }
public void Configure(ISiloBuilder siloBuilder) { siloBuilder .AddMemoryGrainStorage("PubSubStore") .AddRabbitMqStream(Globals.StreamProviderNameDefault, configurator => { configurator.ConfigureRabbitMq(ob => ob.Configure(options => { options.QueueNamePrefix = Globals.StreamNameSpaceDefault; options.NumberOfQueues = CustomQueueNames.Count; })); configurator.ConfigureCacheSize(100); configurator.ConfigureTopologyProvider(CustomNameTopologyProvider.Create); }) .ConfigureLogging(log => log.AddTestDebugLogging()); }
public void Configure(ISiloBuilder siloBuilder) { siloBuilder .AddMemoryGrainStorage("PubSubStore") .AddRabbitMqStream(Globals.StreamProviderNameDefault, configurator => { configurator.ConfigureRabbitMq(ob => ob.Configure(options => { options.Connection.Port = ToxiProxyHelpers.ClientPort; options.QueueNamePrefix = Globals.StreamNameSpaceDefault; options.UseQueuePartitioning = false; })); configurator.ConfigureCacheSize(100); configurator.ConfigureStreamPubSub(StreamPubSubType.ImplicitOnly); configurator.ConfigurePullingAgent(ob => ob.Configure( options => { options.GetQueueMsgsTimerPeriod = TimeSpan.FromMilliseconds(100); })); }) .AddRabbitMqStream(Globals.StreamProviderNameProtoBuf, configurator => { configurator.ConfigureQueueDataAdapter(ProtoBufDataAdapter.Create); configurator.ConfigureRabbitMq(ob => ob.Configure(options => { options.Connection.Port = ToxiProxyHelpers.ClientPort; options.QueueNamePrefix = Globals.StreamNameSpaceProtoBuf; options.UseQueuePartitioning = false; })); configurator.ConfigureCacheSize(100); configurator.ConfigureStreamPubSub(StreamPubSubType.ImplicitOnly); configurator.ConfigurePullingAgent(ob => ob.Configure( options => { options.GetQueueMsgsTimerPeriod = TimeSpan.FromMilliseconds(100); })); }) .Configure <SiloMessagingOptions>(options => { options.ResponseTimeout = TimeSpan.FromMinutes(5); }) .ConfigureLogging(log => log.AddTestDebugLogging()); }
public void Configure(ISiloBuilder hostBuilder) { hostBuilder .AddMemoryGrainStorage("PubSubStore") .AddEventHubStreams(StreamProviderName, b => { b.ConfigureEventHub(ob => ob.Configure(options => { options.ConfigureTestDefaults(EHPath, EHConsumerGroup); })); b.UseAzureTableCheckpointer(ob => ob.Configure(options => { options.ConfigureTableServiceClient(TestDefaultConfiguration.DataConnectionString); options.PersistInterval = TimeSpan.FromSeconds(1); })); b.UseDynamicClusterConfigDeploymentBalancer(); }); }