public MessageSender(EventHubConnectionDetails config, DeviceSendingDetails details)
 {
     _config = config;
     _details = details;
     //number of messages that should be sent per batch
     _messagesPerBatch = details.NumberOfDevices * details.NumberOfDeviceTypes;
 }
Beispiel #2
0
 public MessageSender(EventHubConnectionDetails config, DeviceSendingDetails details)
 {
     _config  = config;
     _details = details;
     //number of messages that should be sent per batch
     _messagesPerBatch = details.NumberOfDevices * details.NumberOfDeviceTypes;
 }
Beispiel #3
0
        private static void ProcessGenerateOptions(GenerateDataOptions options)
        {
            var details = new EventHubConnectionDetails(options.EventHubNamespace, options.EventHubName, options.EventHubSasPolicy, options.EventHubSasKey);

            var deviceDetails = GetDeviceDetails();

            var generator = new MessageGenerator(deviceDetails, details);
            generator.GenerateMessages();
        }
Beispiel #4
0
        private static void Main(string[] args)
        {
            var config = new BlobStorageConnectionDetails("mynewstorageaccnt",
                "R3FFPLqamAfvzpHjx3mJDpC5EHRxzKtTpCiOKgyIjYAd+L59QWHlLRnYlZXcha7pHJ7O/01G5MrpvDcydmfaHw==",
                "mycontainer", "my/root/folder/", "my/archive/folder/");
            var eventHubConfig = new EventHubConnectionDetails("myneweventhub-ns", "myneweventhub",
                "RootManageSharedAccessKey", "52vBalJmNMvgITAvpffQ+6NGFTsyoMNUWlFekLJSxNw=");

             var deviceDetails = new DeviceSendingDetails()
            {
                FailureConditions = new[]
                {
                    new FailedDeviceSettings(3, 0.2F, SensorTypes.Energy),
                    new FailedDeviceSettings(8, 0.3F, SensorTypes.Energy),
                    new FailedDeviceSettings(16, 0.05F, SensorTypes.Energy),
                    new FailedDeviceSettings(19, 0.07F, SensorTypes.Energy),
                    new FailedDeviceSettings(22, 0.25F, SensorTypes.Energy),
                    new FailedDeviceSettings(2, 0.2F, SensorTypes.Light),
                    new FailedDeviceSettings(4, 0.2F, SensorTypes.Light),
                    new FailedDeviceSettings(7, 0.3F, SensorTypes.Light),
                    new FailedDeviceSettings(18, 0.05F, SensorTypes.Light),
                    new FailedDeviceSettings(5, 0.1F, SensorTypes.Humidity),
                    new FailedDeviceSettings(6, 0.2F, SensorTypes.Humidity),
                    new FailedDeviceSettings(8, 0.3F, SensorTypes.Humidity),
                    new FailedDeviceSettings(19, 0.05F, SensorTypes.Humidity),
                    new FailedDeviceSettings(20, 0.07F, SensorTypes.Humidity),
                    new FailedDeviceSettings(3, 0.1F, SensorTypes.Temperature),
                    new FailedDeviceSettings(6, 0.2F, SensorTypes.Temperature),
                    new FailedDeviceSettings(9, 0.3F, SensorTypes.Temperature),
                    new FailedDeviceSettings(12, 0.05F, SensorTypes.Temperature),
                    new FailedDeviceSettings(15, 0.07F, SensorTypes.Temperature),
                    new FailedDeviceSettings(18, 0.15F, SensorTypes.Temperature),
                    new FailedDeviceSettings(21, 0.25F, SensorTypes.Temperature),    
                },
                NumberOfRooms = 10,
                IterationSeconds = 30,
                NumberOfDevices = 50,
                NumberOfDeviceTypes = 4,
                TemperatureMax = 28.9F,
                TemperatureMin = 19.6F,
                HumidityMin = 40.0F,
                HumidityMax = 80.0F,
                EnergyMin = 2000.0F,
                EnergyMax = 4900.0F,
                LightMin = 10.0F,
                LightMax = 1800.0F,
                MillisecondDelay = 1000,
                RedirectToLocalFile = true,
                RedirectFileName = "c:\\\\tmp\\messages.txt"
            };
            var manager = new BlobStorageManager(config);
            var lines = manager.GetLines("messages.txt");

            var sender = new MessageSender(eventHubConfig, deviceDetails);
            sender.SendMessages(lines);
        }
Beispiel #5
0
        private static void ProcessGenerateOptions(GenerateDataOptions options)
        {
            var details = new EventHubConnectionDetails(options.EventHubNamespace, options.EventHubName, options.EventHubSasPolicy, options.EventHubSasKey);

            var deviceDetails = GetDeviceDetails();

            var generator = new MessageGenerator(deviceDetails, details);

            generator.GenerateMessages();
        }
Beispiel #6
0
        private static void ProcessCreateEventHubConsumerGroupOptions(CreateEventHubConsumerGroupOptions options)
        {
            var eventHubConfig = new EventHubConnectionDetails(options.EventHubNamespace, options.EventHubName, options.EventHubSasPolicy, options.EventHubSasKey);
            var configurator   = new EventHubConfigurator(eventHubConfig);

            if (options.NumberOfInstances == 1)
            {
                configurator.AddConsumerGroup(options.ConsumerGroupName);
            }
            else
            {
                for (var i = 0; i < options.NumberOfInstances; i++)
                {
                    configurator.AddConsumerGroup(options.ConsumerGroupName + i);
                }
            }
        }
Beispiel #7
0
        private static void ProcessReplayOptions(ReplayOptions options)
        {
            var connection = new BlobStorageConnectionDetails(options.BlobStoragePolicyName,
                    options.BlobStoragePolicyKey, options.BlobStorageContainer, options.BlobStorageRootFolder,
                    options.BlobStorageArchiveFolder);
            var blobManager = new BlobStorageManager(connection);
            var lines = blobManager.GetLines(options.Filename);

            var deviceDetails = GetDeviceDetails();
            deviceDetails.RedirectToLocalFile = true;
            deviceDetails.RedirectFileName = options.Filename;
            

            var eventHubConfig = new EventHubConnectionDetails(options.EventHubNamespace, options.EventHubName, options.EventHubSasPolicy, options.EventHubSasKey);

            var sender = new MessageSender(eventHubConfig, deviceDetails);
            sender.SendMessages(lines);
        }
Beispiel #8
0
        private static void ProcessReplayOptions(ReplayOptions options)
        {
            var connection = new BlobStorageConnectionDetails(options.BlobStoragePolicyName,
                                                              options.BlobStoragePolicyKey, options.BlobStorageContainer, options.BlobStorageRootFolder,
                                                              options.BlobStorageArchiveFolder);
            var blobManager = new BlobStorageManager(connection);
            var lines       = blobManager.GetLines(options.Filename);

            var deviceDetails = GetDeviceDetails();

            deviceDetails.RedirectToLocalFile = true;
            deviceDetails.RedirectFileName    = options.Filename;


            var eventHubConfig = new EventHubConnectionDetails(options.EventHubNamespace, options.EventHubName, options.EventHubSasPolicy, options.EventHubSasKey);

            var sender = new MessageSender(eventHubConfig, deviceDetails);

            sender.SendMessages(lines);
        }
 public EventHubConfigurator(EventHubConnectionDetails config)
 {
     _config = config;
 }
 public MessageGenerator(DeviceSendingDetails deviceSendingDetails, EventHubConnectionDetails eventHubConnectionDetails)
 {
     DeviceSendingDetails      = deviceSendingDetails;
     EventHubConnectionDetails = eventHubConnectionDetails;
 }
 public EventHubConfigurator(EventHubConnectionDetails config)
 {
     _config = config;
 }
 public MessageGenerator(DeviceSendingDetails deviceSendingDetails, EventHubConnectionDetails eventHubConnectionDetails)
 {
     DeviceSendingDetails = deviceSendingDetails;
     EventHubConnectionDetails = eventHubConnectionDetails;
 }
Beispiel #13
0
        private static void ProcessCreateEventHubConsumerGroupOptions(CreateEventHubConsumerGroupOptions options)
        {
            var eventHubConfig = new EventHubConnectionDetails(options.EventHubNamespace, options.EventHubName, options.EventHubSasPolicy, options.EventHubSasKey);
            var configurator = new EventHubConfigurator(eventHubConfig);

            if (options.NumberOfInstances == 1)
                configurator.AddConsumerGroup(options.ConsumerGroupName);
            else
            {
                for (var i = 0; i < options.NumberOfInstances; i++)
                {
                    configurator.AddConsumerGroup(options.ConsumerGroupName+i);
                }
            }
        }