Example #1
0
        public void OnWaitEvent(ActorId id, string stateName, params Type[] eventTypes)
        {
            if (this.Closed)
            {
                return;
            }

            this.Writer.WriteStartElement("WaitEvent");
            this.Writer.WriteAttributeString("id", id.ToString());
            StringBuilder sb = new StringBuilder();

            foreach (var t in eventTypes)
            {
                if (sb.Length > 0)
                {
                    sb.Append(", ");
                }

                sb.Append(t.FullName);
            }

            this.Writer.WriteAttributeString("event", sb.ToString());
            if (!string.IsNullOrEmpty(stateName))
            {
                this.Writer.WriteAttributeString("state", stateName);
            }

            this.Writer.WriteEndElement();
        }
Example #2
0
        public void OnSendEvent(ActorId targetActorId, string senderName, string senderType, string senderStateName,
                                Event e, Guid opGroupId, bool isTargetHalted)
        {
            if (this.Closed)
            {
                return;
            }

            this.Writer.WriteStartElement("Send");
            this.Writer.WriteAttributeString("target", targetActorId.ToString());

            if (senderName != null && senderType != null)
            {
                this.Writer.WriteAttributeString("senderName", senderName);
                this.Writer.WriteAttributeString("senderType", senderType);
            }

            // TODO: should this be guarded as above?
            this.Writer.WriteAttributeString("senderState", senderStateName);

            this.Writer.WriteAttributeString("event", e.GetType().FullName);
            if (opGroupId != Guid.Empty)
            {
                this.Writer.WriteAttributeString("event", opGroupId.ToString());
            }

            this.Writer.WriteAttributeString("isTargetHalted", isTargetHalted.ToString());
            this.Writer.WriteEndElement();
        }
Example #3
0
        public void OnHalt(ActorId id, int inboxSize)
        {
            if (this.Closed)
            {
                return;
            }

            this.Writer.WriteStartElement("Halt");
            this.Writer.WriteAttributeString("id", id.ToString());
            this.Writer.WriteAttributeString("inboxSize", inboxSize.ToString());
            this.Writer.WriteEndElement();
        }
Example #4
0
        public void OnEnqueueEvent(ActorId id, Event e)
        {
            if (this.Closed)
            {
                return;
            }

            this.Writer.WriteStartElement("EnqueueEvent");
            this.Writer.WriteAttributeString("id", id.ToString());
            this.Writer.WriteAttributeString("event", e.GetType().FullName);
            this.Writer.WriteEndElement();
        }
Example #5
0
        public void OnStateTransition(ActorId id, string stateName, bool isEntry)
        {
            if (this.Closed)
            {
                return;
            }

            this.Writer.WriteStartElement("State");
            this.Writer.WriteAttributeString("id", id.ToString());
            this.Writer.WriteAttributeString("state", stateName);
            this.Writer.WriteAttributeString("isEntry", isEntry.ToString());
            this.Writer.WriteEndElement();
        }
Example #6
0
        public void OnPushState(ActorId id, string currentStateName, string newStateName)
        {
            if (this.Closed)
            {
                return;
            }

            this.Writer.WriteStartElement("Push");
            this.Writer.WriteAttributeString("id", id.ToString());
            this.Writer.WriteAttributeString("currState", currentStateName);
            this.Writer.WriteAttributeString("newState", newStateName);
            this.Writer.WriteEndElement();
        }
Example #7
0
        public void OnPopStateUnhandledEvent(ActorId id, string stateName, Event e)
        {
            if (this.Closed)
            {
                return;
            }

            this.Writer.WriteStartElement("PopUnhandled");
            this.Writer.WriteAttributeString("id", id.ToString());
            this.Writer.WriteAttributeString("state", stateName);
            this.Writer.WriteAttributeString("event", e.GetType().FullName);
            this.Writer.WriteEndElement();
        }
Example #8
0
        public void OnPopState(ActorId id, string currentStateName, string restoredStateName)
        {
            if (this.Closed)
            {
                return;
            }

            this.Writer.WriteStartElement("Pop");
            this.Writer.WriteAttributeString("id", id.ToString());
            this.Writer.WriteAttributeString("currState", currentStateName);
            this.Writer.WriteAttributeString("restoredState", restoredStateName);
            this.Writer.WriteEndElement();
        }
Example #9
0
        public void OnExceptionThrown(ActorId id, string stateName, string actionName, Exception ex)
        {
            if (this.Closed)
            {
                return;
            }

            this.Writer.WriteStartElement("ExceptionThrown");
            this.Writer.WriteAttributeString("id", id.ToString());
            this.Writer.WriteAttributeString("state", stateName);
            this.Writer.WriteAttributeString("action", actionName);
            this.Writer.WriteAttributeString("type", ex.GetType().FullName);
            this.Writer.WriteString(ex.ToString());
            this.Writer.WriteEndElement();
        }
Example #10
0
        public void OnDefaultEventHandler(ActorId id, string stateName)
        {
            if (this.Closed)
            {
                return;
            }

            this.Writer.WriteStartElement("DefaultEvent");
            this.Writer.WriteAttributeString("id", id.ToString());
            if (!string.IsNullOrEmpty(stateName))
            {
                this.Writer.WriteAttributeString("state", stateName);
            }

            this.Writer.WriteEndElement();
        }
Example #11
0
        public void OnWaitEvent(ActorId id, string stateName, Type eventType)
        {
            if (this.Closed)
            {
                return;
            }

            this.Writer.WriteStartElement("WaitEvent");
            this.Writer.WriteAttributeString("id", id.ToString());
            this.Writer.WriteAttributeString("event", eventType.FullName);
            if (!string.IsNullOrEmpty(stateName))
            {
                this.Writer.WriteAttributeString("state", stateName);
            }

            this.Writer.WriteEndElement();
        }
Example #12
0
        public void OnExceptionHandled(ActorId id, string stateName, string actionName, Exception ex)
        {
            if (this.Closed)
            {
                return;
            }

            this.Writer.WriteStartElement("ExceptionHandled");
            this.Writer.WriteAttributeString("id", id.ToString());
            if (!string.IsNullOrEmpty(stateName))
            {
                this.Writer.WriteAttributeString("state", stateName);
            }

            this.Writer.WriteAttributeString("action", actionName);
            this.Writer.WriteAttributeString("type", ex.GetType().FullName);
            this.Writer.WriteString(ex.ToString());
            this.Writer.WriteEndElement();
        }
Example #13
0
        public void OnReceiveEvent(ActorId id, string stateName, Event e, bool wasBlocked)
        {
            if (this.Closed)
            {
                return;
            }

            var eventName = e.GetType().FullName;

            this.Writer.WriteStartElement("Receive");
            this.Writer.WriteAttributeString("id", id.ToString());
            if (!string.IsNullOrEmpty(stateName))
            {
                this.Writer.WriteAttributeString("state", stateName);
            }

            this.Writer.WriteAttributeString("event", eventName);
            this.Writer.WriteAttributeString("wasBlocked", wasBlocked.ToString());
            this.Writer.WriteEndElement();
        }
Example #14
0
        public void OnExecuteAction(ActorId id, string handlingStateName, string currentStateName, string actionName)
        {
            if (this.Closed)
            {
                return;
            }

            this.Writer.WriteStartElement("Action");
            this.Writer.WriteAttributeString("id", id.ToString());
            if (!string.IsNullOrEmpty(currentStateName))
            {
                this.Writer.WriteAttributeString("state", currentStateName);
                if (currentStateName != handlingStateName)
                {
                    this.Writer.WriteAttributeString("handledBy", handlingStateName);
                }
            }

            this.Writer.WriteAttributeString("action", actionName);
            this.Writer.WriteEndElement();
        }
Example #15
0
        /// <inheritdoc/>
        public void OnCreateStateMachine(ActorId id, string creatorName, string creatorType)
        {
            if (this.Closed)
            {
                return;
            }

            this.Writer.WriteStartElement("CreateStateMachine");
            this.Writer.WriteAttributeString("id", id.ToString());

            if (creatorName != null && creatorType != null)
            {
                this.Writer.WriteAttributeString("creatorName", creatorName);
                this.Writer.WriteAttributeString("creatorType", creatorType);
            }
            else
            {
                this.Writer.WriteAttributeString("creatorName", Task.CurrentId.ToString());
                this.Writer.WriteAttributeString("creatorType", "task");
            }

            this.Writer.WriteEndElement();
        }