Esempio n. 1
0
        public void messageQueue_ReceiveCompleted(object sender, System.Messaging.ReceiveCompletedEventArgs e) 
        { 
            manualResetEvent.Reset(); 
            System.Messaging.Message completeMessage = null; 
            System.IO.FileStream fileStream = null; 
            System.IO.StreamWriter streamWriter = null; 
            string fileName = null; 
            byte[] bytes = new byte[2500000]; 
            string xmlstr = string.Empty;                
                try 
                { 
                    // Receive the message 
                    completeMessage = this.messageQueue.EndReceive(e.AsyncResult);                    
                    completeMessage.BodyStream.Read(bytes, 0, bytes.Length); 
 
                    System.Text.ASCIIEncoding ascii = new System.Text.ASCIIEncoding(); 
 
                    long len = completeMessage.BodyStream.Length; 
                    int intlen = Convert.ToInt32(len);                   
                    xmlstr = ascii.GetString(bytes, 0, intlen);                   
                } 
                catch (Exception ex0) 
                { 
                    //Error converting message to string                    
                } 
            }
 public void messageQueue_ReceiveCompleted(object sender, System.Messaging.ReceiveCompletedEventArgs e) 
 { 
     manualResetEvent.Reset(); 
     System.Messaging.Message completeMessage = null; 
     System.IO.FileStream fileStream = null; 
     System.IO.StreamWriter streamWriter = null; 
     string fileName = null; 
Esempio n. 3
0
        private void OnMQReceiveCompleted(object sender, System.Messaging.ReceiveCompletedEventArgs e)
        {
            try
            {
                if (_cts.IsCancellationRequested)
                {
                    return;
                }

                System.Messaging.Message mqMsg = null;
                TEvnt data = default(TEvnt);
                var   mq   = (sender as System.Messaging.MessageQueue);

                mqMsg = mq.EndReceive(e.AsyncResult);
                data  = (TEvnt)mqMsg.Body;
                this.OnEventReceived(data);

                if (_cts.IsCancellationRequested)
                {
                    return;
                }

                mq.BeginReceive();
            }
            catch (Exception ex)
            {
                this.Logger.Error(string.Format("Error during {0}.Subscribe(), in ReceiveCompleted Handler",
                                                this.GetType().Name), ex);
            }
        }
Esempio n. 4
0
        private void OrderReceived(object sender, System.Messaging.ReceiveCompletedEventArgs e)
        {
            System.Messaging.XmlMessageFormatter formatter = new System.Messaging.XmlMessageFormatter(new Type[] { typeof(WorkOrder) });
            System.Messaging.Message             msg       = messageQueueVehiclesToAssemble.EndReceive(e.AsyncResult);
            msg.Formatter = formatter;

            WorkOrder workOrder = msg.Body as WorkOrder;

            // start waiting for the next message
            messageQueueVehiclesToAssemble.BeginReceive();

            FireMessage(workOrder);
        }
Esempio n. 5
0
        private void LockReleaseRequestMessageQueue_ReceiveCompleted(object sender, System.Messaging.ReceiveCompletedEventArgs e)
        {
            System.Messaging.Message receivedMessage = this.m_LockReleaseRequestQueue.EndReceive(e.AsyncResult);

            MessageQueueMessage receviedMessageQueueMessage = new MessageQueueMessage(receivedMessage, MessageDirectionEnum.Received);

            this.m_MessageCollection.Add(receviedMessageQueueMessage);

            this.m_LockReleaseRequestQueue.BeginReceive();
            if (RequestReceived != null)
            {
                this.RequestReceived(this, new UI.CustomEventArgs.MessageReturnEventArgs(receivedMessage));
            }
        }
Esempio n. 6
0
        private void LockReleaseResponseMessageQueue_ReceiveCompleted(object sender, System.Messaging.ReceiveCompletedEventArgs e)
        {
            System.Messaging.Message message = this.m_LockReleaseResponseQueue.EndReceive(e.AsyncResult);
            MessageBody messageBody          = (MessageBody)message.Body;

            MessageQueueMessage messageQueueMessage = new MessageQueueMessage(message, MessageDirectionEnum.Received);

            this.m_MessageCollection.Add(messageQueueMessage);

            this.m_LockReleaseResponseQueue.BeginReceive();
            if (this.AquireLock != null)
            {
                this.AquireLock(messageBody.MasterAccessionNo, new EventArgs());
            }
            if (ResponseReceived != null)
            {
                this.ResponseReceived(this, new UI.CustomEventArgs.MessageReturnEventArgs(message));
            }
        }
 private void messageQueue1_ReceiveCompleted(object sender, System.Messaging.ReceiveCompletedEventArgs e)
 {
 }