internal void SetArrived() { try { this.Modified = DateTime.Now; this.ArrivedTime = DateTime.Now; this.MessageState = Messaging.MessageState.Arrived; this.ItemId = UUID.NewUuid(); m_stream.Replace((byte)MessageState, offset + 1); m_stream.Replace(ItemId.ToByteArray(), offset + 7, 16); m_stream.Replace(ArrivedTime.Ticks, offset + 26); m_stream.Replace(Modified.Ticks, offset + 44); } catch (Exception ex) { throw new MessageException(Messaging.MessageState.StreamReadWriteError, "QueueItem SetArrived error: " + ex.Message); } }
/// <summary> /// Initialize a new instance of QueueItem /// </summary> /// <param name="stream"></param> private QueueItem(Message message, QueueCmd command) { if (message == null) { throw new ArgumentNullException("QueueItem.ctor message"); } message.Command = command; if (message.Command == QueueCmd.Enqueue) { message.ArrivedTime = DateTime.Now; message.MessageState = Messaging.MessageState.Arrived; message.ItemId = UUID.NewUuid(); } message.Modified = DateTime.Now; NetStream stream = new NetStream(); message.EntityWrite(stream, null); stream.Position = 0; m_stream = stream.Copy(); ValidateStream(); Body = stream.ToArray(); MessageState = message.MessageState; Command = message.Command; //Priority = message.Priority; ItemId = message.ItemId; Retry = message.Retry; ArrivedTime = message.ArrivedTime; //SentTime = message.SentTime; Modified = message.Modified; Expiration = message.Expiration; TransformType = message.TransformType; QueueName = message.Destination; Sender = message.Sender; }
public static string NewIdentifier() { return(UUID.NewUuid().ToString()); }