Exemple #1
0
        public static void SendMessage(SubscribeType sType, int id,
                                       Message msg, bool waitingForSubscriber = false)
        {
            if (sType != SubscribeType.Broadcast && !msg.GeneratedChannelMsgType)
            {
                msg.Type = sType.ToString("d") + id + "_" + msg.Type;
                msg.GeneratedChannelMsgType = true;
            }

            msg.WaitingForSubscriber = waitingForSubscriber;
            MessageBus.Instance._queue.Push(msg);
        }
Exemple #2
0
        public void Unsubscribe(SubscribeType sType, string type, object go, MethodInfo methodInfo)
        {
            var channelIds = (go as MonoBehaviour).GetComponent <Channel>().ChannelIds;

            if (channelIds.ContainsKey(sType) && sType != SubscribeType.Broadcast)
            {
                _Unsubscribe(sType.ToString("d") + channelIds[sType] + "_" + type, go, methodInfo);
            }
            else if (sType == SubscribeType.Broadcast)
            {
                _Unsubscribe(type, go, methodInfo);
            }
        }
        public PagedList<Subscriber> GetSubscribers(Guid mailingListID, SubscribeType status, DateTime? since = null, int page = 1, int pageSize = 500)
        {
            var result = _Manager.MakeRequest<SerializableMailingListMemberCollection>(HttpMethod.GET, String.Format("/lists/{0}/subscribers/{1}", mailingListID, status.ToString()), new
            {
                Since = since,
                Page = page,
                PageSize = pageSize
            }).PagedList;

            // populate custom fields with subscriber id, because it is not returned by the response
            result.ForEach(subscriber => subscriber.CustomFields.ToList().ForEach(cf => cf.SubscriberID = subscriber.ID));

            return result;
        }
 /// <summary>
 /// 获取RedisKey
 /// </summary>
 /// <param name="Type"></param>
 /// <param name="Key"></param>
 /// <returns></returns>
 private static string GetChannelKey(SubscribeType Type)
 {
     return("Subscribe_" + Type.ToString());
 }
Exemple #5
0
 public static string GetFullSubscribeType(SubscribeType type, int id, string curType)
 {
     return(type.ToString("d") + id + "_" + curType);
 }