public void PostConstruct()
        {
            EchoSocket = new WebSocket(ECHO_URL);

            LogQueue = new ConcurrentQueue <string> ();

            EchoSocket.OnOpen += (sender, e) => LogQueue.Enqueue("0Connected to: " + ECHO_URL);

            EchoSocket.OnMessage += (sender, e) => LogQueue.Enqueue("1Received: " + e.Data);

            EchoSocket.OnError += (sender, e) => LogQueue.Enqueue("1Error Occurred");

            EchoSocket.OnClose += (sender, e) => LogQueue.Enqueue("2Disconnected With Code: " + e.Code);
        }
Ejemplo n.º 2
0
        void IEventsProcessor.ProcessEvents(string origin, SessionMode mode, IEnumerable <IEvent> events)
        {
            if (origin == _store.Id)
            {
                return;
            }

            ProcessInfo pi;

            pi.Events = events;
            pi.Origin = origin;
            pi.Mode   = mode;
            _processes.Enqueue(pi);

            if (!Monitor.TryEnter(_gate, 10))
            {
                return;
            }

            try
            {
                while (!_processes.IsEmpty)
                {
                    ProcessInfo info;
                    if (_processes.TryDequeue(out info))
                    {
                        ProcessEvents(info);
                    }
                }
            }
            finally
            {
                Monitor.Exit(_gate);
            }
        }
Ejemplo n.º 3
0
        public void AddMessage(Guid messageId, Guid recipientId, object payload, MessagePriority messagePriority, MessageFlags messageFlags)
        {
            var messageContext = messageContextPool.TakeObject();

            messageContext.UpdateAndMarkUnacknowledged(messageId, recipientId, payload, messagePriority, messageFlags);
            unacknowledgedMessageContextsById.Add(messageId, messageContext);
            pendingQueue.Enqueue(messageContext);
        }
Ejemplo n.º 4
0
 public void Process(IMessage message, Action <IMessage> continueWith)
 {
     _messages.Enqueue(message.Priority,
                       new ScheduledTask()
     {
         Message      = message,
         ContinueWith = continueWith
     });
 }
Ejemplo n.º 5
0
        private void NotifyVacuum(SlotList slots)
        {
#if !DEBUG
            if (_jobScheduler != null)
            {
                _involvedSlots.Enqueue(slots);
                _jobScheduler.RequestJob();
            }
#endif
        }
Ejemplo n.º 6
0
 public void Put(T value)
 {
     queue.Enqueue(value);
 }