Query GetDefaultContent(FlowKey key) { var query = (Query)key.Type.New(); FlowContext.Bind(query, key); return(query); }
void BindFlow(TimelinePosition position) { _flow = ReadData(); FlowContext.Bind(_flow, _key, position, TimelinePosition.None); _areaCheckpoint = position.ToInt64(); }
Task <FlowResumeInfo> StartAndResume() { var flow = _key.Type.New(); FlowContext.Bind(flow, _key); return(Resume(flow)); }
Flow LoadFlow() { var flow = ReadInstance(); FlowContext.Bind(flow, _key, _metadata.Position, TimelinePosition.None); return(flow); }
public static T Bind <T>(this T query, Id instanceId) where T : Query { var queryType = query.GetType(); var areaMap = AreaMap.From(new[] { queryType }); AreaTypeName.TryFrom(queryType.Name, out var areaType); var flowType = areaMap.GetFlow(areaType); var subscriptionKey = FlowKey.From(flowType, instanceId); FlowContext.Bind(query, subscriptionKey); return(query); }
Query GetCheckpointContent(FlowKey key, ResolvedEvent e) { var metadata = _context.ReadCheckpointMetadata(e); if (metadata.ErrorPosition.IsSome) { throw new Exception($"Query is stopped at {metadata.ErrorPosition} with the following error: {metadata.ErrorMessage}"); } var query = (Query)_context.Json.FromJsonUtf8(e.Event.Data, key.Type.DeclaredType); FlowContext.Bind(query, key, metadata.Position, metadata.ErrorPosition); return(query); }
void StartIfFirst() { if (Observation.CanBeFirst) { Flow = (T)Key.Type.New(); FlowContext.Bind(Flow, Key); } else { if (!_queue.HasPoint) { CompleteTask(FlowResult.Ignored); } } }
void StartFlowIfFirst() { if (Flow != null) { return; } if (Observation.CanBeFirst) { Flow = (T)Key.Type.New(); FlowContext.Bind(Flow, Key); } else { if (_queue.Count == 0) { CompleteTask(FlowResult.Ignored); } } }
void CreateFlow() { Flow = (T)Key.Type.New(); FlowContext.Bind(Flow, Key); }
void CreateFlow() { _flow = _key.Type.New(); FlowContext.Bind(_flow, _key); }