Пример #1
0
 public EventHub(EventHubConfiguration configuration)
 {
     _configuration = configuration;
     try
     {
         _messagingFactory      = MessagingFactory.CreateFromConnectionString(_configuration.EventHubConnectionString + TransportType);
         _eventHubClient        = _messagingFactory.CreateEventHubClient(_configuration.EventHubName);
         _eventHubConsumerGroup = _eventHubClient.GetConsumerGroup(_configuration.EventHubConsumer);
     }
     catch (Exception e)
     {
         Console.WriteLine($"{DateTime.Now} > Exception: {e.Message}");
         Console.WriteLine("Press any key to exit.");
         Console.ReadLine();
         Environment.Exit(-1);
     }
 }
Пример #2
0
        private static void ShowProcessStep1()
        {
            Console.WriteLine("STEP 1: Provide Event Hub Information");
            Console.WriteLine("##########################################" + Environment.NewLine);
            Console.WriteLine("-> Insert EventHubConnectionString");
            var connectionString = Console.ReadLine();

            Console.WriteLine(connectionString);
            Console.WriteLine("-> Insert EventHubName");
            var name = Console.ReadLine();

            Console.WriteLine(name);
            Console.WriteLine("-> Insert ConsumerName");
            var consumer = Console.ReadLine();

            Console.WriteLine(consumer);
            eventHubConfiguration = new EventHubConfiguration(connectionString, name, consumer);
            Console.WriteLine(Environment.NewLine);
            Console.WriteLine("Checking connection with the Event Hub ...");
            eventHub = new EventHub(eventHubConfiguration);
            eventHub.ShowEventHubRuntimeInformation();
            Console.WriteLine("##########################################" + Environment.NewLine);
        }