[fix]Config创建默认配置文件的开关Runtime.CreateConfigOnMissing,仅需对自动创建生效,而不应该阻止用户主动Save
智能大石头 编写于 2024-08-09 00:30:41 石头 提交于 2024-08-10 14:22:24
X
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NewLife.Log;

namespace NewLife.MessageQueue
{
    /// <summary>测试用例</summary>
    public class MQTest
    {
        /// <summary>基础测试</summary>
        public static void TestBase()
        {
            var svr = new MQServer();
            svr.Start();

            var client = new MQClient();
            client.Name = "user1";
            client.Public("test");

            var user = new MQClient();
            user.Name = "user2";
            user.Received += (s, e) =>
            {
                XTrace.WriteLine("user.收到推送 {0}", e.Arg);
            };
            //user.Open();
            user.Subscribe("test");

            for (int i = 0; i < 3; i++)
            {
                client.Send("test", "测试{0}".F(i + 1));
            }

            Console.ReadKey(true);

            client.Dispose();
            user.Dispose();
            svr.Dispose();
        }
    }
}