示例#1
0
 public MessageStateMachine(IMusicTrackDatabase musicDatabase)
 {
     this.messageRegister   = new MessageRegister();
     this.messageBuilder    = new MessageBuilder(musicDatabase);
     this.messageHistory    = new MessageHistory();
     this.statisticsManager = new StatisticsManager();
 }
 public void Setup()
 {
     _publisher      = new Publisher <IMyMessage>();
     _messageHistory = new MyMessageHistory();
     _handler        = new MyMessageHandler();
     _handler2       = new MyMessageHandler();
 }
示例#3
0
 public void Deliver(IMessageHistory <TConstraint> history)
 {
     foreach (var subscriber in _subscribers)
     {
         ((ISubscriber <TConstraint>)subscriber).Deliver(history);
     }
 }
 public ServerSentEvent(int noOfMessagesToRemember, bool generateMessageIds = false, int heartbeatInterval = 0)
 {
     mHeartbeatInterval = heartbeatInterval;
     mMessageHistory = new MemoryMessageHistory(noOfMessagesToRemember);
     if (generateMessageIds)
         mIdGenerator = new SimpleIdGenerator();
     SetupHeartbeat(heartbeatInterval);
 }
示例#5
0
 public void Deliver(IMessageHistory <TConstraint> history)
 {
     while (_messages.Count > 0)
     {
         var message = _messages.Dequeue();
         HandleDelivery(message);
         history.Push(new MessageEnvelope <TConstraint>(message));
     }
 }
示例#6
0
 public ServerSentEvent(int noOfMessagesToRemember, bool generateMessageIds = false, int heartbeatInterval = 0)
 {
     mHeartbeatInterval = heartbeatInterval;
     mMessageHistory    = new MemoryMessageHistory(noOfMessagesToRemember);
     if (generateMessageIds)
     {
         mIdGenerator = new SimpleIdGenerator();
     }
     SetupHeartbeat(heartbeatInterval);
 }
        public ServerSentEvent(IMessageHistory messageHistory, IMessageIdGenerator idGenerator, int heartbeatInterval = 0)
        {
            if (messageHistory == null)
                throw new ArgumentException("messageHistory can not be null.");

            if (idGenerator == null)
                throw new ArgumentException("idGenerator can not be null.");

            mMessageHistory = messageHistory;
            mIdGenerator = idGenerator;
            mHeartbeatInterval = heartbeatInterval;

            SetupHeartbeat(heartbeatInterval);
        }
示例#8
0
        public ServerSentEvent(IMessageHistory messageHistory, IMessageIdGenerator idGenerator, int heartbeatInterval = 0)
        {
            if (messageHistory == null)
            {
                throw new ArgumentException("messageHistory can not be null.");
            }

            if (idGenerator == null)
            {
                throw new ArgumentException("idGenerator can not be null.");
            }

            mMessageHistory    = messageHistory;
            mIdGenerator       = idGenerator;
            mHeartbeatInterval = heartbeatInterval;

            SetupHeartbeat(heartbeatInterval);
        }
示例#9
0
 internal void SetMessageHistory(IMessageHistory messageHistory)
 {
     this.messageHistory = messageHistory;
 }
 public ServerSentEvent(IMessageHistory messageHistory, IMessageIdGenerator idGenerator, int heartbeatInterval = 0)
     : base(messageHistory, idGenerator, heartbeatInterval)
 {
 }