Пример #1
0
		public void LogSendMessage(StompFrame frame, string destination)
		{
			MessageQueue messageLoggingQueue = null;

			if (_messageLogMessageQueue != null)
			{
				using (_lockObject.Lock())
				{
// ReSharper disable ConditionIsAlwaysTrueOrFalse
					if (_messageLogMessageQueue != null)
// ReSharper restore ConditionIsAlwaysTrueOrFalse
					{
						messageLoggingQueue = _messageLogMessageQueue;
					}
				}
			}

			if (messageLoggingQueue != null)
			{
				var msg = new MessageLogMessage
				          	{
				          		SentAt = DateTime.Now,
				          		ContentLength = frame.GetInt32(StompHeader.ContentLength, 0),
				          		Destination = destination,
				          	};
				var msgFrame = new StompFrame(StompCommand.Message)
				               	{
				               		Headers =
				               			{
				               				{StompHeader.Destination, messageLoggingQueue.Name}
				               			}
				               	};
				msgFrame.Serialize(msg);



				messageLoggingQueue.PublishFrame(msgFrame);
			}
		}