示例#1
0
        /// <summary>
        ///     Write Message to Local Queue
        /// </summary>
        /// <param name="input">Text Message</param>
        /// <returns></returns>
        public void Send(string input)
        {
            try
            {
                _queue        = _queueManager.AccessQueue(_sendQueueName, MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING);
                _message      = MQHelper.Encode(input);
                _queueMessage = new MQMessage();
                _queueMessage.WriteString(_message);
                _queueMessage.Format    = MQC.MQFMT_STRING;
                _queuePutMessageOptions = new MQPutMessageOptions();
                _queue.Put(_queueMessage, _queuePutMessageOptions);

                ResultMessage = "Message sent to the queue successfully";
                IsSuccess     = true;
            }
            catch (Exception exp)
            {
                ResultMessage = "Exception: " + exp.Message;
                IsSuccess     = false;
            }
        }