public void CanFindAssemblyPulsers() { int ev1GeneratedCount = 0; int ev2GeneratedCount = 0; var pulsers = Pulsers.FromAssembly(Assembly.GetExecutingAssembly()).ToList(); EventHandler <IEnumerable <Event> > handler = (o, events) => events.ToList().ForEach(e => { Console.WriteLine(e.EventType); if (e.EventType == "ev1-") { ev1GeneratedCount++; } if (e.EventType == "ev2-") { ev2GeneratedCount++; } }); pulsers.ForEach(x => { x.PulseGenerated += handler; }); pulsers.ForEach(z => z.Start()); Thread.Sleep(2900); pulsers.ForEach(z => z.Stop()); Assert.Equal(2, ev2GeneratedCount); Assert.Equal(3, ev1GeneratedCount); }
public WorkerRole() { _pulsers = Pulsers.FromAssembly(Assembly.GetAssembly(typeof(ImportFileProcessed))) .ToList(); var container = new WindsorContainer(); _configurationValueProvider = new AzureConfigurationValueProvider(); SetupDi(container, _configurationValueProvider, _pulsers.ToArray()); _pulserPublisher = container.Resolve <PulserPublisher>(); _orchestrator = container.Resolve <Orchestrator>(); // insert the list here var keyValueStore = container.Resolve <IDynamoStore>(); var blob = new SimpleBlob() { Body = Assembly.GetExecutingAssembly() .GetManifestResourceStream("BeeHive.Sample.FileImport.Worker.Data.SampleData.txt"), Id = "FileDrop/ImportFiles/SampleData.txt", LastModified = DateTimeOffset.Now }; keyValueStore.UpsertAsync(blob); // add one topic that will not be created automagically by orchestrator // because no actor registered against it var q = container.Resolve <IEventQueueOperator>(); q.CreateQueueAsync(QueueName.FromSimpleQueueName("NewIndexUpserted")).Wait(); }
/// <summary> /// Just a harness /// </summary> private void Can() { Console.WriteLine("{0} {1}", DateTime.Now.ToString("O"), "Starting"); var pulsers = Pulsers.FromAssembly(Assembly.GetExecutingAssembly()).ToList(); EventHandler <IEnumerable <Event> > handler = (o, events) => events.ToList().ForEach(e => { if (e.EventType == "ev2") { Console.WriteLine("{0} {1}", DateTime.Now.ToString("O"), e.EventType); } }); pulsers.ForEach(x => { x.PulseGenerated += handler; }); pulsers.ForEach(z => z.Start()); Thread.Sleep(10900); pulsers.ForEach(z => z.Stop()); }
public WorkerRole() { _pulsers = Pulsers.FromAssembly(Assembly.GetAssembly(typeof(NewsFeedPulsed))) .ToList(); var container = new WindsorContainer(); _configurationValueProvider = new AzureConfigurationValueProvider(); SetupDi(container, _configurationValueProvider, _pulsers.ToArray()); _pulserPublisher = container.Resolve <PulserPublisher>(); _orchestrator = container.Resolve <Orchestrator>(); // insert the list here var keyValueStore = container.Resolve <IKeyValueStore>(); var blob = new SimpleBlob() { Body = new MemoryStream(Encoding.UTF8.GetBytes("http://feeds.bbci.co.uk/news/rss.xml")), Id = "newsFeeds.txt", LastModofied = DateTimeOffset.Now }; keyValueStore.UpsertAsync(blob); }