public async Task Post(AddUsage usage) { var activationContext = FabricRuntime.GetActivationContext(); string applicationInstance = "ServiceFabricPoc.BottleFiller"; var serviceUri = new Uri("fabric:/" + applicationInstance + "/" + BottleFillerServiceName); //We create a unique Guid that is associated with a customer order, as well as with the actor that represents that order's state. IBottleFillerActor bottleFiller = ActorProxy.Create <IBottleFillerActor>(new ActorId(Guid.Parse(usage.Id)), serviceUri); var message = new AddUsageMessage() { NumberOfGallons = usage.NumberOfGallons }; await bottleFiller.AddUsage(message); }
public async Task <Guid> Post(OnBoard onBoard) { var activationContext = FabricRuntime.GetActivationContext(); string applicationInstance = "ServiceFabricPoc.BottleFiller"; var serviceUri = new Uri("fabric:/" + applicationInstance + "/" + BottleFillerServiceName); Guid fillerId = Guid.NewGuid(); //We create a unique Guid that is associated with a customer order, as well as with the actor that represents that order's state. IBottleFillerActor bottleFiller = ActorProxy.Create <IBottleFillerActor>(new ActorId(fillerId), serviceUri); var message = new OnBoardMessage() { Id = onBoard.Id, OnBoardUser = onBoard.OnBoardUser, SerialNumber = onBoard.SerialNumber }; await bottleFiller.OnBoard(message); return(fillerId); }
public async Task <Model.BottleFillerStatistics> GetStatistics(Guid fillerId) { var activationContext = FabricRuntime.GetActivationContext(); string applicationInstance = "ServiceFabricPoc.BottleFiller"; var serviceUri = new Uri("fabric:/" + applicationInstance + "/" + BottleFillerServiceName); //We create a unique Guid that is associated with a customer order, as well as with the actor that represents that order's state. IBottleFillerActor bottleFiller = ActorProxy.Create <IBottleFillerActor>(new ActorId(fillerId), serviceUri); var stats = await bottleFiller.GetCurrentStatistics(); return(new Model.BottleFillerStatistics() { CurrentFilterGallonsUsed = stats.CurrentFilterGallonsUsed, FilterInstallDate = stats.FilterInstallDate, Id = stats.Id, OnBoardUser = stats.OnBoardUser, SerialNumber = stats.SerialNumber, ServiceDate = stats.ServiceDate, TotalGallons = stats.TotalGallons }); }