void OnReceivedChannel(RedisSubscriptionChannel channel) { _count = channel.Count; if (Changed != null) { Changed(this, new RedisSubscriptionChangedEventArgs(channel)); } }
public void HandleSubscription(RedisSubscription command) { _connection.Write(command.Command, command.Arguments); if (!IsSubscribed) { using (new ActivityTracer("Handle subscriptions")) { IsSubscribed = true; while (true) { var resp = _connection.Read(command.Parser); switch (resp.Type) { case RedisSubscriptionResponseType.Subscribe: case RedisSubscriptionResponseType.PSubscribe: case RedisSubscriptionResponseType.Unsubscribe: case RedisSubscriptionResponseType.PUnsubscribe: RedisSubscriptionChannel channel = resp as RedisSubscriptionChannel; Count = channel.Count; if (SubscriptionChanged != null) { SubscriptionChanged(this, new RedisSubscriptionChangedEventArgs(channel)); } break; case RedisSubscriptionResponseType.Message: case RedisSubscriptionResponseType.PMessage: RedisSubscriptionMessage message = resp as RedisSubscriptionMessage; if (SubscriptionReceived != null) { SubscriptionReceived(this, new RedisSubscriptionReceivedEventArgs(message)); } break; } if (Count == 0) { break; } } IsSubscribed = false; } } }
void OnReceivedChannel(RedisSubscriptionChannel channel) { _count = channel.Count; Changed?.Invoke(this, new RedisSubscriptionChangedEventArgs(channel)); }
internal RedisSubscriptionChangedEventArgs(RedisSubscriptionChannel response) { Response = response; }