Esempio n. 1
0
        /// <summary>
        /// 
        /// </summary>
        protected MQHandlerSync()
            : base()
        {
            _mqSender = new MQSender();
            _mqReceiver = new MQReceiver();

        }
        /// <summary>
        /// 
        /// </summary>
        protected MQExternalHandler()
            : base()
        {
            _mqSender = new MQSender();
            _mqReceiver = new MQReceiver();

        }
Esempio n. 3
0
        /// <summary>
        /// Testing MQ send 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonSend_Click(object sender, EventArgs e)
        {
             try
            {
            MQSender mqSender = new MQSender();
            MQConnection mqcon = new MQConnection();
            mqcon.Init("1", ConfigurationSettings.AppSettings["MQHOST"], int.Parse(ConfigurationSettings.AppSettings["MQPORT"]), ConfigurationSettings.AppSettings["MQName"]);
            mqcon.Open();
            //mqSender.Init(ConfigurationSettings.AppSettings["Test_2591"], mqcon);
            mqSender.Init(ConfigurationSettings.AppSettings["Test_2591"], mqcon);

            MQMessage msg = new MQMessage();
            msg.HeaderMcd.McdType = MQMessage.MQHeaderMcd.Request;
            msg.HeaderUser.UserBaseDate.Value = DateTime.Now.ToShortDateString();
            msg.HeaderUser.UserServiceId.Value = "11";
            msg.HeaderUser.UserServiceStatus.Value = "0";
            msg.HeaderUser.UserServiceGuage.Value = "0";
            msg.HeaderUser.UserServiceGuageInfo.Value = String.Empty;
            msg.HeaderUser.UserUserId.Value = "12";
            msg.HeaderUser.UserTaskCode.Value = "1290";
            msg.Text = "MQ test 消息";
           
                mqSender.SendMessage(msg);
   
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 4
0
 public bool InitMQ(MQSender sender, MQReceiver receiver)
 {
     if (sender != null && receiver != null)
     {
         _mqSender = sender;
         _mqReceiver = receiver;
         return true;
     }
     return false;
 }