Exemplo n.º 1
0
		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;
		}
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
		/// <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);
			}
		}
Exemplo n.º 4
0
		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;
		}