Exemplo n.º 1
0
        protected EventMessage[] GetSubscribersInternal(IEventStorage storage)
        {
            var keys = storage.GetKeys(this.SubscriberKeyPrefix + "*");

            if (keys == null || keys.Length <= 0)
            {
                return(null);
            }
            var result = storage.MultiGet(keys);

            if (result == null || result.Length <= 0)
            {
                return(null);
            }
            var list = new List <EventMessage>(result.Length);

            foreach (var bytes in result)
            {
                if (bytes != null && bytes.Length > 0)
                {
                    var message = this.Serializer.Deserialize <EventMessage>(bytes, null);
                    if (message != null)
                    {
                        list.Add(message);
                    }
                }
            }
            return(list.ToArray());
        }