Ejemplo n.º 1
0
        private void PublishMessage(BackPlateMessage message)
        {
            var msg = message.Serialize();

            lock (this.messageLock)
            {
                if (message.Action == BackPlateAction.Clear)
                {
                    Interlocked.Exchange(ref this.skippedMessages, this.messages.Count);
                    this.messages.Clear();
                }

                if (!this.messages.Add(msg))
                {
                    Interlocked.Increment(ref this.skippedMessages);
                    if (this.logger.IsEnabled(LogLevel.Trace))
                    {
                        this.logger.LogTrace("Skipped duplicate message: {0}.", msg);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 private void PublishMessage(BackPlateMessage message)
 {
     this.Publish(message.Serialize());
 }