public static void Run([EntityTrigger] IDurableEntityContext ctx, ILogger log) { var action = ctx.OperationName.ToLowerInvariant(); var state = ctx.GetState <ReportingManagementState>(); if (action == "$init" && state == null) { state = new ReportingManagementState(ctx.GetInput <StateDetails>()); } switch (action) { case "savepowerbiconnection": var actionReq = ctx.GetInput <ExecuteActionRequest>(); state.SavePowerBIConnection(actionReq.Arguments.Metadata["PowerBI"].ToObject <PowerBIModel>()); break; } ctx.SetState(state); ctx.StartNewOrchestration("SendState", state); // ctx.Return(state); }
public static async Task <Status> EmitState([ActivityTrigger] ReportingManagementState state, ILogger log, [SignalR(HubName = ReportingManagementState.HUB_NAME)] IAsyncCollector <SignalRMessage> signalRMessages) { var stateDetails = state.StateDetails; var groupName = StateUtils.BuildGroupName(stateDetails); var sendMethod = $"ReceiveState"; await signalRMessages.AddAsync(new SignalRMessage() { Target = sendMethod, GroupName = groupName, Arguments = new[] { state } }); return(Status.Success); }