public async Task <BottleFillerStatistics> OnBoard(OnBoardMessage message) { var statistics = new BottleFillerStatistics() { Id = message.Id, SerialNumber = message.SerialNumber, OnBoardUser = message.OnBoardUser, CurrentFilterGallonsUsed = 0, FilterInstallDate = DateTimeOffset.UtcNow, ServiceDate = DateTimeOffset.UtcNow, TotalGallons = 0 }; await this.StateManager.SetStateAsync <BottleFillerStatistics>(BottleFillerStatisticsPropertyName, statistics); await SetOrderStatusAsync(BottleFillerStatus.OnBoarded); return(statistics); }
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); }