public void SetMessageProperties(MsmqIntegrationMessageProperty property)
        {
            property.AcknowledgeType     = (System.Messaging.AcknowledgeTypes) this.acknowledge.Value;
            property.Acknowledgment      = (System.Messaging.Acknowledgment) this.Class.Value;
            property.AdministrationQueue = GetQueueName(this.adminQueue.GetValue(this.adminQueueLength.Value));
            property.AppSpecific         = this.appSpecific.Value;
            property.ArrivedTime         = MsmqDateTime.ToDateTime(this.arrivedTime.Value).ToLocalTime();
            property.Authenticated       = this.authenticated.Value != 0;
            property.BodyType            = this.bodyType.Value;
            property.CorrelationId       = MsmqMessageId.ToString(this.correlationId.Buffer);
            property.DestinationQueue    = GetQueueName(this.destinationQueue.GetValue(this.destinationQueueLength.Value));
            property.Extension           = this.extension.GetBufferCopy(this.extensionLength.Value);
            property.Id    = MsmqMessageId.ToString(this.MessageId.Buffer);
            property.Label = this.label.GetValue(this.labelLength.Value);

            if (this.Class.Value == UnsafeNativeMethods.MQMSG_CLASS_NORMAL)
            {
                property.MessageType = System.Messaging.MessageType.Normal;
            }
            else if (this.Class.Value == UnsafeNativeMethods.MQMSG_CLASS_REPORT)
            {
                property.MessageType = System.Messaging.MessageType.Report;
            }
            else
            {
                property.MessageType = System.Messaging.MessageType.Acknowledgment;
            }

            property.Priority      = (System.Messaging.MessagePriority) this.priority.Value;
            property.ResponseQueue = GetQueueName(this.responseFormatName.GetValue(this.responseFormatNameLength.Value));
            property.SenderId      = this.SenderId.GetBufferCopy(this.SenderIdLength.Value);
            property.SentTime      = MsmqDateTime.ToDateTime(this.sentTime.Value).ToLocalTime();
            property.InternalSetTimeToReachQueue(MsmqDuration.ToTimeSpan(this.timeToReachQueue.Value));
        }
Exemplo n.º 2
0
 public void SetMessageProperties(MsmqIntegrationMessageProperty property)
 {
     property.AcknowledgeType     = new AcknowledgeTypes?((AcknowledgeTypes)this.acknowledge.Value);
     property.Acknowledgment      = new Acknowledgment?((Acknowledgment)base.Class.Value);
     property.AdministrationQueue = GetQueueName(this.adminQueue.GetValue(this.adminQueueLength.Value));
     property.AppSpecific         = new int?(this.appSpecific.Value);
     property.ArrivedTime         = new DateTime?(MsmqDateTime.ToDateTime(this.arrivedTime.Value).ToLocalTime());
     property.Authenticated       = new bool?(this.authenticated.Value != 0);
     property.BodyType            = new int?(this.bodyType.Value);
     property.CorrelationId       = MsmqMessageId.ToString(this.correlationId.Buffer);
     property.DestinationQueue    = GetQueueName(this.destinationQueue.GetValue(this.destinationQueueLength.Value));
     property.Extension           = this.extension.GetBufferCopy(this.extensionLength.Value);
     property.Id    = MsmqMessageId.ToString(base.MessageId.Buffer);
     property.Label = this.label.GetValue(this.labelLength.Value);
     if (base.Class.Value == 0)
     {
         property.MessageType = 2;
     }
     else if (base.Class.Value == 1)
     {
         property.MessageType = 3;
     }
     else
     {
         property.MessageType = 1;
     }
     property.Priority      = new MessagePriority?((MessagePriority)this.priority.Value);
     property.ResponseQueue = GetQueueName(this.responseFormatName.GetValue(this.responseFormatNameLength.Value));
     property.SenderId      = base.SenderId.GetBufferCopy(base.SenderIdLength.Value);
     property.SentTime      = new DateTime?(MsmqDateTime.ToDateTime(this.sentTime.Value).ToLocalTime());
     property.InternalSetTimeToReachQueue(MsmqDuration.ToTimeSpan(this.timeToReachQueue.Value));
 }
 public MsmqIntegrationOutputMessage(MsmqChannelFactoryBase <IOutputChannel> factory, int bodySize, EndpointAddress remoteAddress, MsmqIntegrationMessageProperty property) : base(factory, bodySize, remoteAddress, 8)
 {
     if (property.AcknowledgeType.HasValue)
     {
         this.EnsureAcknowledgeProperty((byte)property.AcknowledgeType.Value);
     }
     if (null != property.AdministrationQueue)
     {
         this.EnsureAdminQueueProperty(property.AdministrationQueue, false);
     }
     if (property.AppSpecific.HasValue)
     {
         this.appSpecific = new NativeMsmqMessage.IntProperty(this, 8, property.AppSpecific.Value);
     }
     if (property.BodyType.HasValue)
     {
         base.EnsureBodyTypeProperty(property.BodyType.Value);
     }
     if (property.CorrelationId != null)
     {
         this.correlationId = new NativeMsmqMessage.BufferProperty(this, 3, MsmqMessageId.FromString(property.CorrelationId));
     }
     if (property.Extension != null)
     {
         this.extension = new NativeMsmqMessage.BufferProperty(this, 0x23, property.Extension);
     }
     if (property.Label != null)
     {
         this.label = new NativeMsmqMessage.StringProperty(this, 11, property.Label);
     }
     if (property.Priority.HasValue)
     {
         this.priority = new NativeMsmqMessage.ByteProperty(this, 4, (byte)property.Priority.Value);
     }
     if (null != property.ResponseQueue)
     {
         this.EnsureResponseQueueProperty(property.ResponseQueue);
     }
     if (property.TimeToReachQueue.HasValue)
     {
         base.EnsureTimeToReachQueueProperty(MsmqDuration.FromTimeSpan(property.TimeToReachQueue.Value));
     }
 }
            public MsmqIntegrationOutputMessage(
                MsmqChannelFactoryBase <IOutputChannel> factory,
                int bodySize,
                EndpointAddress remoteAddress,
                MsmqIntegrationMessageProperty property)
                : base(factory, bodySize, remoteAddress, 8)
            {
                if (null == property)
                {
                    Fx.Assert("MsmqIntegrationMessageProperty expected");
                }

                if (property.AcknowledgeType.HasValue)
                {
                    EnsureAcknowledgeProperty((byte)property.AcknowledgeType.Value);
                }

                if (null != property.AdministrationQueue)
                {
                    EnsureAdminQueueProperty(property.AdministrationQueue, false);
                }

                if (property.AppSpecific.HasValue)
                {
                    this.appSpecific = new IntProperty(this, UnsafeNativeMethods.PROPID_M_APPSPECIFIC, property.AppSpecific.Value);
                }

                if (property.BodyType.HasValue)
                {
                    EnsureBodyTypeProperty(property.BodyType.Value);
                }

                if (null != property.CorrelationId)
                {
                    this.correlationId = new BufferProperty(this, UnsafeNativeMethods.PROPID_M_CORRELATIONID, MsmqMessageId.FromString(property.CorrelationId));
                }

                if (null != property.Extension)
                {
                    this.extension = new BufferProperty(this, UnsafeNativeMethods.PROPID_M_EXTENSION, property.Extension);
                }

                if (null != property.Label)
                {
                    this.label = new StringProperty(this, UnsafeNativeMethods.PROPID_M_LABEL, property.Label);
                }

                if (property.Priority.HasValue)
                {
                    this.priority = new ByteProperty(this, UnsafeNativeMethods.PROPID_M_PRIORITY, (byte)property.Priority.Value);
                }

                if (null != property.ResponseQueue)
                {
                    EnsureResponseQueueProperty(property.ResponseQueue);
                }

                if (property.TimeToReachQueue.HasValue)
                {
                    EnsureTimeToReachQueueProperty(MsmqDuration.FromTimeSpan(property.TimeToReachQueue.Value));
                }
            }