public CoordinatorActor()
        {
            var a = Context.System.ActorOf <Actors.ClusterMonitor>("cluster");

            // when the first note joins, start up data stream
            Receive <ReadyToCollect>(r =>
            {
                // don't want multiple of these active
                if (eh != null)
                {
                    eh = new EventHubService();
                    eh.StartReceivers();
                }
            });
        }
        public JsonResult UploadData(XmlStringModel model)
        {
            var     _result = new JsonResponse();
            dynamic _meta   = new ExpandoObject();

            // give a sample id
            var _id = Guid.NewGuid().ToString().Substring(0, 8);

            _result.id = _id;


            // save to blob
            var _blobResult = BlobService.SaveBlobFromString(model.xmlContent, model.contentType, model.containerName, _id + ".xml");

            // handle blobsave error
            if (!_blobResult.success)
            {
                return(Json(_blobResult));
            }

            // add blob url to response
            _meta.BlobUrl = _blobResult.meta.BlobUrl;

            var _redisResult = RedisService.AddToCache(_id, model.xmlContent);

            //handle redis save error
            if (!_redisResult.success)
            {
                return(Json(_redisResult));
            }

            // add redis success to response
            _meta.RedisSuccess = true;

            var _item           = new KeyValuePair <string, string>(_id, model.xmlContent);
            var _eventHubResult = EventHubService.AddToEventHub(JsonConvert.SerializeObject(_item));


            _result.meta = _meta;

            return(Json(_result));
        }
        private async Task startTracking()
        {
            // get the list of devices to track
            await deviceInfoService.Initialize();

            SensorInformation.Text = "";
            foreach (GattDeviceService deviceService in deviceInfoService.deviceServices)
            {
                TagReaderService tagReader = new TagReaderService();
                await tagReader.InitializeSensor();
                SensorInformation.Text += await tagReader.GetSensorID(deviceService);
                if (tagReader != null)
                    this.tagReaders.Add(tagReader);
            }


            eventHubService = new EventHubService(app.ServiceBusNamespace,
            app.EventHubName, app.SharedAccessPolicyName, app.SharedAccessPolicyKey);

            //StatusField.Text = "The sensor is connected";
            txtError.Text = "";
            eventHubWriterTimer.Start();
            StartCommand.Content = "Stop";
            StartCommand.Tag = "STARTED";


            numberOfFailedCallsToEventHub = numberOfCallsDoneToEventHub = 0;
            EventHubInformation.Text = $"Calls: {numberOfCallsDoneToEventHub}, Failed Calls: {numberOfFailedCallsToEventHub}";
        }
 public MainService()
 {
     InitializeComponent();
     _eventHubService = new EventHubService();
 }
 public HomeController(IMediator mediator, IHostedService eventHubService)
 {
     _mediator        = mediator;
     _eventHubService = eventHubService as EventHubService;
 }
Exemple #6
0
 public Handler(ConfigurationDatabase configurationDatabase, IHostedService eventHubService)
 {
     _configurationDatabase = configurationDatabase;
     _eventHubService       = eventHubService as EventHubService;
 }