コード例 #1
0
 public void ConsumeMessage(MessageToken messageToken)
 {
     foreach (var executionPath in ExecutionPathLst)
     {
         ConsumeMessage(executionPath, messageToken);
     }
 }
コード例 #2
0
        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;
        }
コード例 #3
0
        private string GetIncomingMessage(MessageToken incoming, string path)
        {
            var result = incoming.JObjMessageContent.SelectToken(path);

            if (result == null)
            {
                return(null);
            }

            return(result.ToString());
        }
コード例 #4
0
        public object Clone()
        {
            var result = new MessageToken
            {
                Id             = Id,
                Name           = Name,
                MessageContent = MessageContent,
                Type           = Type
            };

            return(result);
        }
コード例 #5
0
        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;
        }
コード例 #6
0
        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);
                }
            }
        }
コード例 #7
0
        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);
        }
コード例 #8
0
 public virtual bool IsSatisfied(ProcessInstanceAggregate processInstance, MessageToken token)
 {
     return(false);
 }
コード例 #9
0
 public override bool IsSatisfied(ProcessInstanceAggregate processInstance, MessageToken token)
 {
     return(processInstance.IsMessageCorrect(token));
 }