public static void StartTimerForTestEvents() { IBus bus = RabbitHutch.CreateBus("host=localhost"); Observable .Timer(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(10)) .Subscribe( x => { var random = new Random(); var heartCmd = new HeartRateCommand() { CommandId = Guid.NewGuid().ToString(), HeartRate = Convert.ToInt16(random.Next(60, 65)) }; bus.Publish(heartCmd); Console.WriteLine("Published test HeartRateCommand."); }); Observable .Timer(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(50)) .Subscribe( x => { var random = new Random(); var mediationStateCmd = new MeditationStateCommand() { CommandId = Guid.NewGuid().ToString(), State = Convert.ToInt16(random.Next(0, 5)) }; bus.Publish(mediationStateCmd); Console.WriteLine("Published test MeditationStateCommand."); }); Console.WriteLine("StartTimerForTestEvents()...."); }
private static void MeditationStateCommand(MeditationStateCommand obj) { throw new NotImplementedException(); }