//get acknowledgement if message successfully received from the queue.
        public void ReceiveAcknowledgment(string messageId, string queuePath)
        {
            bool found = false;

            MessageQueue queue = new MessageQueue(queuePath);
            queue.MessageReadPropertyFilter.CorrelationId = true;
            queue.MessageReadPropertyFilter.Acknowledgment = true;

            try
            {
                while (queue.PeekByCorrelationId(messageId) != null)
                {
                    Message myAcknowledgmentMessage = queue.ReceiveByCorrelationId(messageId);

                    // Output acknowledgment message information.
                    Console.WriteLine("Acknowledgment Type: " + myAcknowledgmentMessage.Acknowledgment.ToString());
                    found = true;
                }
            }
            catch (InvalidOperationException e)
            {
                if (found == false)
                {
                    Console.WriteLine(e.Message);
                }
            }
            catch (NullReferenceException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        // Peeks message (first/application-specified correlationId) from status queue
        private Message PeekFromStatusQueue(string correlationId)
        {
            string statusQueuePath = "FormatName:DIRECT=OS:" + this.queue.MachineName + @"\" + Parameters.STATUS_QUEUE;
            MessageQueue statusQueue = new MessageQueue(statusQueuePath);
            statusQueue.Formatter = new BinaryMessageFormatter();
            statusQueue.MessageReadPropertyFilter.AppSpecific = true;
            statusQueue.MessageReadPropertyFilter.CorrelationId = true;

            Message statusMessage = null;
            try
            {
                if (correlationId == null)
                {
                    statusMessage = statusQueue.PeekByLookupId(MessageLookupAction.First, 0);
                }
                else
                {
                    statusMessage = statusQueue.PeekByCorrelationId(correlationId, TimeSpan.Zero);
                }
            }
            catch (MessageQueueException)
            {
                // If status queue is empty, peek will throw MessageQueueException
                throw new InvalidOperationException();
            }

            statusQueue.Dispose();
            statusQueue.Close();
            return statusMessage;
        }