public async Task <RouteToActorWorkItem> HandleWorkItem(RouteToActorWorkItem workItem)
        {
            IIoTActor DeviceActor = this.getActor(workItem);
            await DeviceActor.Post(workItem.PublisherName, workItem.EventHubName, workItem.ServiceBusNS, workItem.Body);


            return(null); // if a workItem is returned, it signals the work manager to re-enqueu
        }
        private Task ForwardToStorageActorAsync(string DeviceId, string EventHubName, string ServiceBusNS, byte[] Body)
        {
            if (null == this.storageActor)
            {
                this.storageActor = this.CreateStorageActor(DeviceId, EventHubName, ServiceBusNS);
            }

            return(this.storageActor.Post(DeviceId, EventHubName, ServiceBusNS, Body));
        }
Esempio n. 3
0
        private Task ForwardToStorageActorAsync(string DeviceId, string EventHubName, string ServiceBusNS, byte[] Body)
        {
            if (null == this.storageActor)
            {
                this.storageActor = this.GetStorageActorProxy(DeviceId, EventHubName, ServiceBusNS);
            }

            return this.storageActor.Post(DeviceId, EventHubName, ServiceBusNS, Body);
        }
Esempio n. 4
0
        private Task ForwardToPowerBIActor(string DeviceId, string EventHubName, string ServiceBusNS, byte[] Body)
        {
            if (null == this.powerBIActor)
            {
                this.powerBIActor = this.GetPowerBIActorProxy(DeviceId, EventHubName, ServiceBusNS);
            }

            return(this.powerBIActor.Post(DeviceId, EventHubName, ServiceBusNS, Body));
        }
Esempio n. 5
0
        private async Task ForwardToBuildingActorAsync(string DeviceId, string EventHubName, string ServiceBusNS, byte[] Body)
        {
            if (null == this.buildingActor)
            {
                JObject j          = JObject.Parse(Encoding.UTF8.GetString(Body));
                string  BuildingId = j["BuildingId"].Value <string>();

                this.buildingActor = this.CreateBuildingActor(BuildingId, EventHubName, ServiceBusNS);
            }
            await this.buildingActor.Post(DeviceId, EventHubName, ServiceBusNS, Body);
        }
        private Task ForwardToFloorActorAsync(string DeviceId, string EventHubName, string ServiceBusNS, byte[] Body)
        {
            if (null == this.floorActor)
            {
                JObject j       = JObject.Parse(Encoding.UTF8.GetString(Body));
                string  FloorId = j["FloorId"].Value <string>();

                this.floorActor = this.CreateFloorActor(DeviceId, FloorId, EventHubName, ServiceBusNS);
            }
            return(this.floorActor.Post(DeviceId, EventHubName, ServiceBusNS, Body));
        }
Esempio n. 7
0
        private Task ForwardToFloorActorAsync(string DeviceId, string EventHubName, string ServiceBusNS, byte[] Body)
        {
            if (null == this.floorActor)
            {
                JObject j = JObject.Parse(Encoding.UTF8.GetString(Body));
                string FloorId = j["FloorId"].Value<string>();

                this.floorActor = this.GetFloorActorProxy(DeviceId, FloorId, EventHubName, ServiceBusNS);
            }

            return this.floorActor.Post(DeviceId, EventHubName, ServiceBusNS, Body);
        }
        private IIoTActor getActor(RouteToActorWorkItem wi)
        {
            if (this.deviceActor != null)
            {
                return(this.deviceActor);
            }

            lock (this.actorLock)
            {
                if (this.deviceActor != null)
                {
                    return(this.deviceActor);
                }

                ActorId id = new ActorId(wi.QueueName);
                this.deviceActor = ActorProxy.Create <IIoTActor>(id, new Uri(deviceActorServiceName));
                return(this.deviceActor);
            }
        }