private void ProcessPendingMessageSets(MessageSet current) { NextMessageSetNumber = current.Number + 1; _processMessageSet(current); while (_messageSets.TryGetValue(NextMessageSetNumber, out current)) { _messageSets.Remove(NextMessageSetNumber); NextMessageSetNumber = current.Number + 1; _processMessageSet(current); } }
public bool ProcessMessageSet(MessageSet messageSet) { lock (_syncLock) { if (messageSet.Number == NextMessageSetNumber) { ProcessPendingMessageSets(messageSet); return true; } Platform.Log(LogLevel.Warn, "Received message set out of order (received:{0}, expected:{1})", messageSet.Number, NextMessageSetNumber); _messageSets[messageSet.Number] = messageSet; return false; } }
public ProcessMessagesResult ProcessMessages(MessageSet messageSet) { IApplication application = FindApplication(messageSet.ApplicationId); if (application == null) return null; try { return application.ProcessMessages(messageSet); } catch (Enterprise.Common.InvalidUserSessionException ex) { Platform.Log(LogLevel.Error, ex, "Error has occurred in ProcessMessages"); throw new FaultException<SessionValidationFault>(new SessionValidationFault { ErrorMessage = ExceptionTranslator.Translate(ex) }); } catch (Enterprise.Common.PasswordExpiredException ex) { Platform.Log(LogLevel.Error, ex, "Error has occurred in ProcessMessages"); throw new FaultException<SessionValidationFault>(new SessionValidationFault { ErrorMessage = ExceptionTranslator.Translate(ex) }); } catch (Enterprise.Common.UserAccessDeniedException ex) { Platform.Log(LogLevel.Error, ex, "Error has occurred in ProcessMessages"); throw new FaultException<SessionValidationFault>(new SessionValidationFault { ErrorMessage = ExceptionTranslator.Translate(ex) }); } catch (Enterprise.Common.RequestValidationException ex) { Platform.Log(LogLevel.Error, ex, "Error has occurred in ProcessMessages"); throw new FaultException<SessionValidationFault>(new SessionValidationFault { ErrorMessage = ExceptionTranslator.Translate(ex) }); } catch (Exception ex) { Platform.Log(LogLevel.Error, ex, "Error has occurred in ProcessMessages"); throw new FaultException(ExceptionTranslator.Translate(ex)); } }
protected override ProcessMessagesResult OnProcessMessageEnd(MessageSet messageSet, bool messageWasProcessed) { if (!messageWasProcessed) { return new ProcessMessagesResult { EventSet = null, Pending = true }; } bool hasMouseMoveMsg = false; foreach (Message m in messageSet.Messages) { if (m is MouseMoveMessage) { hasMouseMoveMsg = true; break; } } EventSet ev = GetPendingOutboundEvent(hasMouseMoveMsg ? 100 : 0); return new ProcessMessagesResult { EventSet = ev, Pending = false }; }