Exemple #1
0
        private string CreateConsumerNameByIP()
        {
            if (string.IsNullOrEmpty(IPValue))
            {
                IPValue = IPUtils.IPToInt(IPUtils.GetLocalIP()).ToString();
                AssertUtils.IsNotEmpty(IPValue, "获取本机IP地址错误");
            }

            return($"{RedisMessageBusOptions.DefaultConsumerName}_{IPValue}");
        }
        internal UIDGeneratorIPImpl(IPUIDOptions options)
        {
            EpochDateTime = options.EpochDateTime;

            MaxTimestamp   = BitUtils.MaxVaue(TimestampBit);
            MaxSequence    = BitUtils.MaxVaue(SequenceBit);
            MaxTimeCheck   = BitUtils.MaxVaue(TimeCheckBit);
            MaxIp          = BitUtils.MaxVaue(IpBit);
            IP             = IPUtils.IPToInt() & 0x0000ffff; //取后2位
            IpShift        = 0;
            TimeCheckShift = IpBit;
            SequenceShift  = TimeCheckBit + IpBit;
            TimestampShift = SequenceBit + TimeCheckBit + IpBit;
        }
 private string CreateConsumerNameByIP()
 {
     return($"{RedisMessageBusOptions.DefaultConsumerName}_{IPUtils.IPToInt(IPUtils.GetLocalIP())}");
 }