Exemplo n.º 1
0
 public EventHubObserver(EventHubConfig config)
 {
     try
     {
         _config         = config;
         _eventHubClient = EventHubClient.CreateFromConnectionString(_config.ConnectionString, config.EventHubName);
         this._logger    = new Logger(ConfigurationManager.AppSettings["logger_path"]);
     }
     catch (Exception ex)
     {
         _logger.Write(ex);
         throw ex;
     }
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            var config = new EventHubConfig();


            // Uncomment for picking from Configuration
            config.ConnectionString = ConfigurationManager.AppSettings["EventHubConnectionString"];
            config.EventHubName     = ConfigurationManager.AppSettings["EventHubName"];

            //To push 1 event per second
            var eventHubevents = Observable.Interval(TimeSpan.FromSeconds(1)).Select(i => Badge.Generate());

            //To send Data to EventHub as JSON
            var eventHubDis = eventHubevents.Subscribe(new EventHubObserver(config));

            Console.ReadLine();
            eventHubDis.Dispose();
        }
        static void Main(string[] args)
        {
            var config = new EventHubConfig();
                  
            
            // Uncomment for picking from Configuration 
            config.ConnectionString = ConfigurationManager.AppSettings["EventHubConnectionString"];
            config.EventHubName = ConfigurationManager.AppSettings["EventHubName"];
                        
            //To push 1 event per second
            var eventHubevents = Observable.Interval(TimeSpan.FromSeconds(1)).Select(i => Badge.Generate());

            //To send Data to EventHub as JSON
            var eventHubDis = eventHubevents.Subscribe(new EventHubObserver(config));
                                
            Console.ReadLine();
            eventHubDis.Dispose();
                   
	
        }