public void ConsumeMessage(MessageToken messageToken) { foreach (var executionPath in ExecutionPathLst) { ConsumeMessage(executionPath, messageToken); } }
private void Handle(IncomingTokenAddedEvent evt) { var pointer = GetExecutionPointer(evt.ExecutionPathId, evt.ExecutionPointerId); var tokens = MessageToken.DeserializeLst(evt.SerializedToken); pointer.AddIncoming(tokens); Version = evt.Version; UpdateDateTime = evt.CreateDateTime; }
private string GetIncomingMessage(MessageToken incoming, string path) { var result = incoming.JObjMessageContent.SelectToken(path); if (result == null) { return(null); } return(result.ToString()); }
public object Clone() { var result = new MessageToken { Id = Id, Name = Name, MessageContent = MessageContent, Type = Type }; return(result); }
private void Handle(ExecutionPointerAddedEvent evt) { var tokens = MessageToken.DeserializeLst(evt.SerializedTokens); var path = GetExecutionPath(evt.ExecutionPathId); path.Pointers.Add(new ExecutionPointer { Id = evt.ExecutionPointerId, ExecutionPathId = path.Id, FlowNodeId = evt.FlowNodeId, InstanceFlowNodeId = evt.FlowNodeInstanceId, Incoming = tokens }); Version = evt.Version; UpdateDateTime = evt.CreateDateTime; }
private void ConsumeMessage(ExecutionPath executionPath, MessageToken messageToken) { foreach (var pointer in executionPath.ActivePointers) { var nodeDef = GetDefinition(pointer.FlowNodeId) as BaseCatchEvent; if (nodeDef == null) { continue; } if (nodeDef.EventDefinitions.Any(_ => _.IsSatisfied(this, messageToken))) { var tokens = new List <MessageToken> { messageToken }; var evt = new IncomingTokenAddedEvent(Guid.NewGuid().ToString(), AggregateId, Version + 1, executionPath.Id, pointer.Id, JsonConvert.SerializeObject(tokens), DateTime.UtcNow); Handle(evt); DomainEvents.Add(evt); } } }
public bool IsMessageCorrect(string messageRef, MessageToken messageToken) { var message = GetMessageByName(messageToken.Name); if (message == null || messageToken.Name != message.Name || message.EltId != messageRef) { return(false); } var item = GetItem(message.ItemRef); if (item == null) { return(true); } var type = TypeResolver.ResolveType(item.StructureRef); if (item == null || type == null) { return(false); } object result = null; try { result = JsonConvert.DeserializeObject(messageToken.MessageContent.ToString(), type); } catch { return(false); } return(result != null); }
public virtual bool IsSatisfied(ProcessInstanceAggregate processInstance, MessageToken token) { return(false); }
public override bool IsSatisfied(ProcessInstanceAggregate processInstance, MessageToken token) { return(processInstance.IsMessageCorrect(token)); }