public override void Run() { _logger.Info("Sender entry point called"); RoleEnvironment.Stopping += (sender, args) => _isStopping = true; var creds = GetCredentials(); var startSignal = new ManualResetEventSlim(false); using (var sb = ServiceBusFactory.New(sbc => { sbc.ReceiveFromComponents(creds); sbc.UseAzureServiceBus(); sbc.UseAzureServiceBusRouting(); sbc.UseNLog(); //sbc.UseGraphite(); sbc.Subscribe(s => { s.Handler <ZoomDone>(zd => { _isStopping = true; }); s.Handler <ReadySetGo>(go => startSignal.Set()); }); })) { var receiver = sb.GetEndpoint(creds.BuildUri("receiver")); receiver.Send <SenderUp>(new { Source = creds.BuildUri() }); startSignal.Wait(); var count = 0; var watch = Stopwatch.StartNew(); // it sends about 3 x stopcount in the time receiver has to get them _logger.Info("starting sending"); while (!_isStopping && count != 1500) { var msg = new ZoomImpl { Id = CombGuid.Generate() }; receiver.Send <ZoomZoom>(msg); count++; } watch.Stop(); _logger.Info("sent nuff zooms {0}, in {1} seconds for a day. Idling again!", count, watch.ElapsedMilliseconds / 1000.0); while (true) { Thread.Sleep(5000); } } }
public ExecutionParamsImpl() { ZoomImpl = new ZoomImpl(); PagingImpl = new PagingImpl(); }