v2.6.2024.1004 支持RocketMQ v5.3,在公网测试通过。默认内网broker地址替换为公网地址。
大石头 authored at 2024-10-05 01:14:36
878.00 B
NewLife.RocketMQ
using System;
using System.Linq;
using NewLife;
using NewLife.Log;
using NewLife.RocketMQ;
using Xunit;

// 所有测试用例放入一个汇编级集合,除非单独指定Collection特性
[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly)]

namespace XUnitTestRocketMQ;

[Collection("Basic")]
public class BasicTest
{
    private static MqSetting _config;
    public static MqSetting GetConfig()
    {
        if (_config != null) return _config;
        lock (typeof(BasicTest))
        {
            if (_config != null) return _config;

            var set = MqSetting.Current;
            if (set.IsNew)
            {
                set.NameServer = "rocketmq.newlifex.com:9876";
                set.Save();
            }

            XTrace.WriteLine("RocketMQ配置:{0}", set.NameServer);

            return _config = set;
        }
    }
}