// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { IClientActorSystem orleansClient = StartClientWithRetries().GetAwaiter().GetResult(); services.AddSingleton <IEmailCheck, EmailCheck>(serviceProvider => { return(new EmailCheck(orleansClient)); }); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); }
static void RunGui(IClientActorSystem system) { Host.CreateDefaultBuilder() .ConfigureWebHostDefaults(webBuilder => { webBuilder.ConfigureServices(x => x.AddSingleton(system)); webBuilder.UseStartup <Startup>(); }) .Build() .Run(); }
static async Task Run(IClientActorSystem system) { var some = system.ActorOf <ISomeActor>("some"); var another = system.ActorOf <IAnotherActor>("another"); var actor = await some.Ask(new GetSelf()); var stream = await some.Ask(new GetStream()); var item1 = new Item { Name = "PS3", Paid = DateTimeOffset.UtcNow.AddHours(-2), Price = 600 }; var item2 = new Item { Name = "XBOX", Paid = DateTimeOffset.UtcNow.AddHours(-9), Price = 500 }; await another.Tell(new Notify { Observer = actor, Item = item1 }); await another.Tell(new Push { Stream = stream, Item = item2 }); var received = await some.Ask(new GetReceived()); Verify(received[0], item1); Verify(received[1], item2); using (var observable = await system.CreateObservable()) { Item observed = null; using (observable.Subscribe <Item>(x => observed = x)) { var item3 = new Item { Name = "Nintendo", Paid = DateTimeOffset.UtcNow, Price = 300 }; await another.Tell(new Notify { Observer = observable.Ref, Item = item3 }); Thread.Sleep(2000); Verify(observed, item3); } } }
public static async Task Main(string[] args) { resume = args.Length == 1 && args[0] == "resume"; Console.WriteLine("Make sure you've started Azure storage emulator!"); Console.WriteLine("Running example. Booting cluster might take some time ...\n"); var account = CloudStorageAccount.DevelopmentStorageAccount; SS.Table = await SetupTable(account); var host = await new SiloHostBuilder() .ConfigureApplicationParts(x => x .AddApplicationPart(Assembly.GetExecutingAssembly()) .WithCodeGeneration()) .UseOrleankka() .Start(); var client = await host.Connect(); system = client.ActorSystem(); try { (resume ? Resume() : Run()).Wait(); } catch (AggregateException e) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(e.InnerException.Message); } Console.WriteLine("\nPress any key to terminate ..."); Console.ReadKey(true); host.Dispose(); Environment.Exit(0); }
public void SetUp() { system = TestActorSystem.Instance; }
public ChatClient(IClientActorSystem system, string user, string room) { this.system = system; this.user = user; this.room = system.ActorOf <IChatRoom>(room); }
public ChatClient(IClientActorSystem system, string user, string room) { this.system = system; this.user = user; this.room = system.ActorOf($"ChatRoom:{room}"); }
public EmailCheck(IClientActorSystem c) { client = c; }
public DomainController(IClientActorSystem system) { this.system = system; }