static void Main(string[] args) { var(seats, emps) = RegistrationUtil.Seed(10, 7); int batch = 3; var que = QueueUtil <Employee> .InitQueue(emps); var qUtil = new QueueUtil <Employee>(que); var prevcfh = new List <Employee>(); for (int i = 0; i < days; i++) { Console.WriteLine($"--------------DAY-{i}--------------"); var cfhEmps = qUtil.Next(batch) as List <Employee>; //PrintEmployees(cfhEmps); var inOfficeEmps = emps.Except(cfhEmps).ToList(); //PrintEmployees(inOfficeEmps); Allocate(seats, inOfficeEmps, prevcfh, cfhEmps); //prevcfh = GetNextCfh(cfhEmps, emps, batch); prevcfh = cfhEmps; } Console.ReadLine(); }
//private static readonly ILog log = LogManager.GetLogger(typeof(Program)); private static void Main(string[] pArgs) { // Debugger.Launch(); // // Set up a simple configuration that logs on the console. // XmlConfigurator.Configure(new System.IO.FileInfo("Publisher.log4net.xml")); // log.Info("TEST"); // //Debugger.Break(); QueueUtil.Prepare("msmq://localhost/rhino_publisher", QueueType.Standard); var host = new DefaultHost(); host.Start <PublisherBootStrapper>(); Console.WriteLine("Publisher: Hit Enter to publish ..."); var bus = host.Bus as IServiceBus; if (bus == null) { return; } while (true) { var lLine = Console.ReadLine(); if (lLine.StartsWith("q")) { return; } bus.Publish(new HelloWorldMessage { Say = "Hello World!!! " + Guid.NewGuid() }); } }
/// <summary> /// This is called by the client passing unique key that was given to it by the server /// And the value of the door status. This is compiled and added to the queue /// </summary> /// <param name="id">unique id of the query</param> /// <param name="doorName">Name of the door</param> /// <param name="val">value of the status</param> /// <returns></returns> public async Task SetDoorStatus(string id, string doorName, string val) { Debug.WriteLine($"Val is {val}"); // add to queue var queUtil = new QueueUtil(); await queUtil.AddToQueue(id + val); }
static void Main(string[] args) { QueueUtil.PrepareQueue("customer"); var host = new DefaultHost(); host.Start <CustomerBootStrapper>(); Console.WriteLine("Ayende is visiting Starbucks ..."); Console.WriteLine("Hit enter for buying a hot chocolate ..."); //Give the other services a bit air to initialize. Console.ReadLine(); var bus = host.Bus as IServiceBus; var customer = new CustomerController(bus) { Drink = "Hot Chocolate", Name = "Starbucks Lover", Size = DrinkSize.Venti }; customer.BuyDrinkSync(); Console.ReadLine(); }
public void GetDesiredRoleCounts_WorksAsExpected(string input, int dExpected, int hExpected, int tExpected) { var(d, h, t) = QueueUtil.GetDesiredRoleCounts(input); Assert.That(d == dExpected); Assert.That(h == hExpected); Assert.That(t == tExpected); }
private static void Main(string[] args) { //TestMain(); //return; QueueUtil.Prepare("msmq://localhost/rhino_subscriber", QueueType.Standard); QueueUtil.Prepare("msmq://localhost/audit.queue", QueueType.Standard); var host = new DefaultHost(); host.Start <SubscriberBootStrapper>(); var lBus = host.Bus as IServiceBus; if (lBus == null) { return; } Console.WriteLine("Subscriber is listening..."); while (true) { var lLine = Console.ReadLine(); if (lLine.StartsWith("q")) { return; } lBus.Send(new HelloWorldMessage { Say = "Hello World!" }); Console.WriteLine("Sending HelloWorld!"); } }
static void Main(string[] args) { QueueUtil.PrepareQueue("barista"); Console.WriteLine("Barista: Ready for drink preparation ..."); var host = new DefaultHost(); host.Start <BaristaBootStrapper>(); Console.ReadLine(); }
static void Main(string[] args) { QueueUtil.PrepareQueue("cashier"); var host = new DefaultHost(); host.Start <CashierBootStrapper>(); Console.WriteLine("Cashier: Waiting for message . . . "); Console.ReadLine(); }
static void Main(string[] args) { QueueUtil.PrepareQueue("backend"); Console.WriteLine("Backend: Starting to listen for incoming messages ..."); var host = new DefaultHost(); host.Start <BackendBootStrapper>(); Console.ReadLine(); }
static void Main(string[] args) { QueueUtil.PrepareQueue("cashier"); QueueUtil.PrepareQueue("barista"); QueueUtil.PrepareQueue("customer"); var cashier = new RemoteAppDomainHost(typeof(CashierBootStrapper)) .Configuration("Cashier.config"); cashier.Start(); Console.WriteLine("Cashier has started"); var barista = new RemoteAppDomainHost(typeof(BaristaBootStrapper)) .Configuration("Barista.config"); barista.Start(); Console.WriteLine("Barista has started"); var customerHost = new DefaultHost(); customerHost.BusConfiguration(c => { c.Bus("rhino.queues://localhost:53000/LearningRhinoESB_E8_Customer", "customer"); c.Receive("Messages.Cashier", "rhino.queues://localhost:52000/LearningRhinoESB_E8_Cashier"); c.Receive("Messages.Barista", "rhino.queues://localhost:51000/LearningRhinoESB_E8_Barista"); return(c); }); customerHost.Start <CustomerBootStrapper>(); var bus = customerHost.Bus as IServiceBus; var customer = new CustomerController(bus) { Drink = "Hot Chocolate", Name = "Ayende", Size = DrinkSize.Venti }; customer.BuyDrinkSync(); Console.ReadLine(); }
static void Main(string[] args) { QueueUtil.PrepareQueue("client"); var host = new DefaultHost(); host.Start <ClientBootStrapper>(); Console.WriteLine("Client 1: Hit enter to send message"); Console.ReadLine(); var bus = host.Bus as IServiceBus; bus.Send(new HelloWorldMessage { Content = "Hello World!!!" }); Console.ReadLine(); }
static void Main(string[] args) { QueueUtil.Prepare("msmq://localhost/rhino_publisher.balancer", QueueType.Standard); QueueUtil.Prepare("msmq://localhost/rhino_publisher.balancer.acceptingwork", QueueType.Standard); var host = new DefaultHost(); host.Start <StructureMapLoadBalancerBootStrapper>(); Console.WriteLine("Publisher.balancer: Gestartet ..."); while (true) { var lLine = Console.ReadLine(); if (lLine.StartsWith("q")) { return; } } }
/// <summary> /// Method creates a GUID and invokes client method. It is expected that the client will call a method on the Signal R Hub. /// With the GUID and the return value. /// The hub method will compose a queue message and add it to the queue. /// This method will wait till a message with the unique id shows up in the queue /// </summary> /// <param name="doorName"></param> /// <returns></returns> public async Task <string> GetDoorStatus(string doorName) { // get the context var homeContext = GlobalHost.ConnectionManager.GetHubContext <GarageDoorHub>(); Debug.WriteLine($"Pre-Garage door open"); // create a guid var id = Guid.NewGuid().ToString(); var queUtil = new QueueUtil(); // ensure that the door name exists var grp = homeContext.Clients.Group(doorName); if (grp != null) { // Not sure why sending only to group does not work. // if you can find the solution, let me know. // commented code kept here for reference //homeContext.Clients.Group(doorName).CheckGarageDoor(id, doorName); //var args = new string[] { id, doorName }; //await grp.Invoke("CheckGarageDoor", args); // grp.CheckGarageDoor(id, doorName); // send message to client to check garage door with the id homeContext.Clients.All.CheckGarageDoor(id, doorName); // wait for the message to show up var ret = await queUtil.WaitForMessage(id, 200 * 1000); // obtain value from the message and return it to the caller if (!string.IsNullOrEmpty(ret)) { var val = ret.Substring(id.Length); return(val); } } return("Unknown"); }
public void Configuration(IAppBuilder app) { QueueUtil.EnsureCreated(); app.MapSignalR(); }