コード例 #1
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);
            }
        }
コード例 #2
0
 /// <summary>
 /// MQ receive
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void buttonReceive_Click(object sender, EventArgs e)
 {
     MQReceiver receiver = new MQReceiver();
     MQConnection mqcon = new MQConnection();
     mqcon.Init("1", ConfigurationSettings.AppSettings["MQHOST"], int.Parse(ConfigurationSettings.AppSettings["MQPORT"]), ConfigurationSettings.AppSettings["MQName"]);
     mqcon.Open();
     receiver.Init(ConfigurationSettings.AppSettings["Test_2591"], mqcon);
     receiver.RegisterMessageReceiver(MessageReceiver_Callback);
 }
コード例 #3
0
ファイル: MQReceiver.cs プロジェクト: joeiren/quant_mq
 /// <summary>
 /// ��ʼ�������ߣ������ʼ��ʧ�ܣ����׳��쳣
 /// </summary>
 /// <param name="aQueueName">��������</param>
 /// <param name="mqConnection">MQ����</param>
 public void Init(string aQueueName, MQConnection mqConnection)
 {
     _queueName = String.Format("queue://{0}", aQueueName);
     base.InitCore(mqConnection);
 }
コード例 #4
0
ファイル: MQPublisher.cs プロジェクト: joeiren/quant_mq
 /// <summary>
 /// ��ʼ�������ߣ������ʼ��ʧ�ܣ����׳��쳣
 /// </summary>
 /// <param name="mqConnection">MQ����</param>
 public void Init(MQConnection mqConnection)
 {
     base.InitCore(mqConnection);
 }