sdk升级

.netcore 升级到6.0

添加事件总线

https://github.com/dotnetcore/CAP

使用rabbmitmq

https://doc.rg1008.com/docs/rg_pass_dev/rg_pass_dev-1dns7a84ddmhg

使用mongodb

https://doc.rg1008.com/docs/rg_pass_dev/rg_pass_dev-1d9o9e279ldgc

关闭历史通知,通过cap实现订阅


  if (!_configuration.GetValue<bool>("operation:disabledSubPush"))
                {
                    _subPush.Sub<ResultOps<object>>(new ResultOps<object>
                    {
                        Data = new
                        {
                            Queues = pf.Queues,
                            Params = jToken,
                        },
                        Params = pfTemp,
                        PrimaryColumn = sqlConfig.SaveSqlPrimary.PrimaryColumn
                    }, pfTemp);
                }


 var ops = new Dictionary<string, object>();
                ops["data"] = new
                {
                    Queues = pf.Queues,
                    Params = jToken,
                };
                ops["params"] = pfTemp;
                ops["primarys"] = sqlConfig.SaveSqlPrimary.PrimaryColumn;
                ops["values"] = sos.Data;

                _capBus.PublishAsync<PFGlobalMapper>("pushpull.data.services.detail", new PFGlobalMapper
                {
                    Ops = ops,

使用代码


  #region 事件总线推送
                List<string> lstIds = new List<string>();
                foreach (var item in sos.Data)
                {
                    foreach (var itemC in item)
                    {
                        lstIds.Add(itemC.Value?.ToString());
                    }
                }

                var ops = new Dictionary<string, object>();
                ops["data"] = new
                {
                    Queues = pf.Queues,
                    Params = jToken,
                };
                ops["params"] = pfTemp;
                ops["primarys"] = sqlConfig.SaveSqlPrimary.PrimaryColumn;
                ops["values"] = sos.Data;

                _capBus.PublishAsync<PFGlobalMapper>("pushpull.data.services.detail", new PFGlobalMapper
                {
                    Ops = ops,
                    PushMapperFieldIdx = sqlConfig.PushMapperFieldIdx,
                    OwnerId = pf.OwnerId,
                    SysId = pf.SysId,
                    ModuleKey = mkey,
                    ReponseField = resField,
                    MapperField = mkey,
                    RequestModuleType = RequestModuleType.Delete,
                    Ids = lstIds.Where(temp => !string.IsNullOrEmpty(temp)).Distinct()
                });
                #endregion 事件总线推送

可以通过类型判断数据


  var ops = new Dictionary<string, object>();
                ops["data"] = new
                {
                    Queues = pf.Queues=new string(),
                    Params = jToken=new JToken(),
                };
                ops["params"] = pfTemp=new PFGlobalParameter();
                ops["primarys"] = sqlConfig.SaveSqlPrimary.PrimaryColumn=new List<SqlPrimary>();
                ops["values"] = sos.Data=new List<Dictionary<string, object>>();

推送类别说明



   #region 事件总线推送
                List<string> lstIds = new List<string>();
                foreach (var item in sos.Data)
                {
                    foreach (var itemC in item)
                    {
                        lstIds.Add(itemC.Value?.ToString());
                    }
                }

                var ops = new Dictionary<string, object>();
                ops["data"] = new
                {
                    Queues = pf.Queues=new string(),
                    Params = jToken=new JToken(),
                };
                ops["params"] = pfTemp=new PFGlobalParameter();
                ops["primarys"] = sqlConfig.SaveSqlPrimary.PrimaryColumn=new List<SqlPrimary>();
                ops["values"] = sos.Data=new List<Dictionary<string, object>>();

                _capBus.PublishAsync<PFGlobalMapper>("pushpull.data.services.detail", new PFGlobalMapper
                {
                    Ops = ops,
                    PushMapperFieldIdx = sqlConfig.PushMapperFieldIdx,
                    OwnerId = pf.OwnerId,
                    SysId = pf.SysId,
                    ModuleKey = mkey,
                    ReponseField = resField,
                    MapperField = mkey,
                    RequestModuleType = RequestModuleType.Delete,
                    Ids = lstIds.Where(temp => !string.IsNullOrEmpty(temp)).Distinct()
                });
                #endregion 事件总线推送
文档更新时间: 2022-04-06 06:57   作者:admin