Skip to content

Instantly share code, notes, and snippets.

@dcomartin dcomartin/startup.cs
Created Dec 14, 2017

Embed
What would you like to do?
using System;
using Botwin;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Orleans;
using Orleans.Runtime.Configuration;
using Polly;
namespace Web
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddBotwin();
services.AddSingleton(provider =>
{
return Policy<IClusterClient>
.Handle<Exception>()
.WaitAndRetry(new[]
{
TimeSpan.FromSeconds(1),
TimeSpan.FromSeconds(2),
TimeSpan.FromSeconds(3)
})
.Execute(() =>
{
var config = ClientConfiguration.LocalhostSilo(30000);
var client = ClientBuilder.CreateDefault()
.UseConfiguration(config)
.Build();
client.Connect().Wait();
return client;
});
});
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseBotwin();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.