/// <summary> /// Sets the new state of the message flow processing of this token. /// </summary> /// <remarks>This method is synchronized and can block.</remarks> /// <param name="messageFlowState">new message flow state</param> public void SetMessageFlowState(MessageFlowState messageFlowState) { lock (SyncLock) { XElement xWorkFlowState = Content.XDocument.XPathSelectElement("token/messageflow-state"); XSerializer.Serializer(messageFlowState, xWorkFlowState); } }
public void UpdateTokenMessageFlowState(string updatingProcessorName, Token targetToken, MessageFlowState messageFlowState) { lock (syncLock) { storage.UpdateToken(targetToken, delegate(Token token) { if (messageFlowState.AssignedProcessor == updatingProcessorName) { messageFlowState.LastResponseFromProcessor = DateTime.Now; token.SetMessageFlowState(messageFlowState); } }); } }
/// <summary> /// Obtains the state of the message flow processing of this token. /// </summary> /// <remarks>This method is synchronized and can block.</remarks> /// <returns>existing message flow state; or a new instance if there /// is no message flow state stored; never null</returns> public MessageFlowState GetMessageFlowState() { lock (SyncLock) { XElement xWorkFlowState = Content.XDocument.XPathSelectElement("token/messageflow-state"); MessageFlowState result = XSerializer.Deserialize<MessageFlowState>(xWorkFlowState); if (result == null) { result = new MessageFlowState(); } return result; } }