コード例 #1
0
ファイル: AsyncMessage.cs プロジェクト: GodLesZ/svn-dump
		protected override MessageBase CopyImpl(MessageBase clone) {
			// Instantiate the clone, if a derived type hasn't already.
			if (clone == null)
				clone = new AsyncMessage();
			// Allow base type(s) to copy their state into the new clone.
			base.CopyImpl(clone);
			// Copy our state into the clone.
			((AsyncMessage)clone)._correlationId = _correlationId;
			return clone;
		}
コード例 #2
0
ファイル: AsyncMessage.cs プロジェクト: hakanaku2009/svn-dump
 protected override MessageBase CopyImpl(MessageBase clone)
 {
     // Instantiate the clone, if a derived type hasn't already.
     if (clone == null)
     {
         clone = new AsyncMessage();
     }
     // Allow base type(s) to copy their state into the new clone.
     base.CopyImpl(clone);
     // Copy our state into the clone.
     ((AsyncMessage)clone)._correlationId = _correlationId;
     return(clone);
 }
コード例 #3
0
ファイル: PlayEngine.cs プロジェクト: GodLesZ/svn-dump
		/// <summary>
		/// Send message to output stream and handle exceptions.
		/// </summary>
		/// <param name="message"></param>
		private void DoPushMessage(AsyncMessage message) {
			try {
				_msgOut.PushMessage(message);
				if (message is RtmpMessage) {
					IRtmpEvent body = ((RtmpMessage)message).body;
					if (body is IStreamData && ((IStreamData)body).Data != null) {
						_bytesSent += ((IStreamData)body).Data.Limit;
					}
				}
			} catch (Exception ex) {
				log.Error("Error while pushing message.", ex);
			}
		}
コード例 #4
0
ファイル: MsmqAdapter.cs プロジェクト: GodLesZ/svn-dump
		private AsyncMessage ConvertMsmqMessage(Message message) {
			AsyncMessage asyncMessage = new AsyncMessage();
			asyncMessage.body = message.Body;
			asyncMessage.destination = DestinationDefinition.Id;
			asyncMessage.clientId = Guid.NewGuid().ToString("D");
			asyncMessage.messageId = Guid.NewGuid().ToString("D");
			asyncMessage.timestamp = Environment.TickCount;

			asyncMessage.headers["MSMQId"] = message.Id;
			asyncMessage.headers["MSMQLabel"] = message.Label;
			//asyncMessage.headers["MSMQBody"] = message.Body;
			if (message.Body != null) {
				PropertyInfo[] propertyInfos = message.Body.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
				foreach (PropertyInfo pi in propertyInfos) {
					if (pi.GetGetMethod() != null && pi.GetGetMethod().GetParameters().Length == 0)
						asyncMessage.headers[pi.Name] = pi.GetValue(message.Body, null);
				}
				FieldInfo[] fieldInfos = message.Body.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance);
				foreach (FieldInfo fi in fieldInfos) {
					asyncMessage.headers[fi.Name] = fi.GetValue(message.Body);
				}
			}
			return asyncMessage;
		}