public void UpdateConsumerSubscriptionTopics(ClientChannel clientChannel, IEnumerable <string> subscriptionTopics) { var subscriptionTopicChanged = false; IEnumerable <string> oldSubscriptionTopics = new List <string>(); IEnumerable <string> newSubscriptionTopics = new List <string>(); _consumerSubscriptionTopicDict.AddOrUpdate(clientChannel.ClientId, key => { subscriptionTopicChanged = true; newSubscriptionTopics = subscriptionTopics; return(subscriptionTopics); }, (key, old) => { if (IsStringCollectionChanged(old.ToList(), subscriptionTopics.ToList())) { subscriptionTopicChanged = true; oldSubscriptionTopics = old; newSubscriptionTopics = subscriptionTopics; } return(subscriptionTopics); }); if (subscriptionTopicChanged) { _logger.InfoFormat("Consumer subscription topics changed. groupName:{0}, consumerId:{1}, old:{2}, new:{3}", _groupName, clientChannel.ClientId, string.Join("|", oldSubscriptionTopics), string.Join("|", newSubscriptionTopics)); } }
public void UpdateConsumerConsumingQueues(ClientChannel clientChannel, IEnumerable <string> consumingQueues) { var consumingQueueChanged = false; IEnumerable <string> oldConsumingQueues = new List <string>(); IEnumerable <string> newConsumingQueues = new List <string>(); _consumerConsumingQueueDict.AddOrUpdate(clientChannel.ClientId, key => { newConsumingQueues = consumingQueues; if (consumingQueues.Count() > 0) { consumingQueueChanged = true; } return(consumingQueues); }, (key, old) => { if (IsStringCollectionChanged(old.ToList(), consumingQueues.ToList())) { consumingQueueChanged = true; oldConsumingQueues = old; newConsumingQueues = consumingQueues; } return(consumingQueues); }); if (consumingQueueChanged) { _logger.InfoFormat("Consumer consuming queues changed. groupName:{0}, consumerId:{1}, old:{2}, new:{3}", _groupName, clientChannel.ClientId, string.Join("|", oldConsumingQueues), string.Join("|", newConsumingQueues)); } }
public void UpdateConsumerConsumingQueues(ClientChannel clientChannel, IEnumerable<string> consumingQueues) { var consumingQueueChanged = false; IEnumerable<string> oldConsumingQueues = new List<string>(); IEnumerable<string> newConsumingQueues = new List<string>(); _consumerConsumingQueueDict.AddOrUpdate(clientChannel.ClientId, key => { newConsumingQueues = consumingQueues; if (consumingQueues.Count() > 0) { consumingQueueChanged = true; } return consumingQueues; }, (key, old) => { if (IsStringCollectionChanged(old.ToList(), consumingQueues.ToList())) { consumingQueueChanged = true; oldConsumingQueues = old; newConsumingQueues = consumingQueues; } return consumingQueues; }); if (consumingQueueChanged) { _logger.InfoFormat("Consumer consuming queues changed. groupName:{0}, consumerId:{1}, old:{2}, new:{3}", _groupName, clientChannel.ClientId, string.Join("|", oldConsumingQueues), string.Join("|", newConsumingQueues)); } }
public void RegisterConsumer(string groupName, ClientChannel clientChannel, IEnumerable<string> subscriptionTopics, IEnumerable<string> consumingQueues) { var consumerGroup = _consumerGroupDict.GetOrAdd(groupName, new ConsumerGroup(groupName, this)); consumerGroup.Register(clientChannel); consumerGroup.UpdateConsumerSubscriptionTopics(clientChannel, subscriptionTopics); consumerGroup.UpdateConsumerConsumingQueues(clientChannel, consumingQueues); }
public void RegisterConsumer(string groupName, ClientChannel clientChannel, IEnumerable <string> subscriptionTopics) { var consumerGroup = _consumerGroupDict.GetOrAdd(groupName, new ConsumerGroup(groupName)); consumerGroup.GetOrAddChannel(clientChannel); consumerGroup.UpdateChannelSubscriptionTopics(clientChannel, subscriptionTopics); }
public void UpdateConsumerSubscriptionTopics(ClientChannel clientChannel, IEnumerable<string> subscriptionTopics) { var subscriptionTopicChanged = false; IEnumerable<string> oldSubscriptionTopics = new List<string>(); IEnumerable<string> newSubscriptionTopics = new List<string>(); _consumerSubscriptionTopicDict.AddOrUpdate(clientChannel.ClientId, key => { subscriptionTopicChanged = true; newSubscriptionTopics = subscriptionTopics; return subscriptionTopics; }, (key, old) => { if (IsStringCollectionChanged(old.ToList(), subscriptionTopics.ToList())) { subscriptionTopicChanged = true; oldSubscriptionTopics = old; newSubscriptionTopics = subscriptionTopics; } return subscriptionTopics; }); if (subscriptionTopicChanged) { _logger.InfoFormat("Consumer subscription topics changed. groupName:{0}, consumerId:{1}, old:{2}, new:{3}", _groupName, clientChannel.ClientId, string.Join("|", oldSubscriptionTopics), string.Join("|", newSubscriptionTopics)); } }
public void RegisterConsumer(string groupName, ClientChannel clientChannel, IEnumerable <string> subscriptionTopics, IEnumerable <string> consumingQueues) { var consumerGroup = _consumerGroupDict.GetOrAdd(groupName, new ConsumerGroup(groupName, this)); consumerGroup.Register(clientChannel); consumerGroup.UpdateConsumerSubscriptionTopics(clientChannel, subscriptionTopics); consumerGroup.UpdateConsumerConsumingQueues(clientChannel, consumingQueues); }
public void Register(ClientChannel clientChannel) { var consumer = _consumerDict.AddOrUpdate(clientChannel.ClientId, key => { _logger.InfoFormat("Consumer added into group. groupName:{0}, consumerId:{1}, remotingAddress:{2}", _groupName, clientChannel.ClientId, clientChannel.Channel.RemotingAddress); return clientChannel; }, (key, old) => clientChannel); consumer.LastUpdateTime = DateTime.Now; }
public void GetOrAddChannel(ClientChannel clientChannel) { var currentChannel = _consumerChannelDict.GetOrAdd(clientChannel.Channel.RemotingAddress, key => { _logger.DebugFormat("Added consumer client into consumer group. consumerGroup:{0}, consumerId:{1}, channel:{2}", _groupName, clientChannel.ClientId, clientChannel.Channel); return clientChannel; }); currentChannel.LastUpdateTime = DateTime.Now; }
public void Register(ClientChannel clientChannel) { var consumer = _consumerDict.AddOrUpdate(clientChannel.ClientId, key => { _logger.InfoFormat("Consumer registered. consumerGroup:{0}, consumerId:{1}, remotingEndPoint:{2}", _groupName, clientChannel.ClientId, clientChannel.Channel.RemotingEndPoint); return clientChannel; }, (key, old) => clientChannel); consumer.LastUpdateTime = DateTime.Now; }
public void GetOrAddChannel(ClientChannel clientChannel) { var currentChannel = _consumerChannelDict.GetOrAdd(clientChannel.Channel.RemotingAddress, key => { _logger.DebugFormat("Added consumer client into consumer group. consumerGroup:{0}, consumerId:{1}, channel:{2}", _groupName, clientChannel.ClientId, clientChannel.Channel); return(clientChannel); }); currentChannel.LastUpdateTime = DateTime.Now; }
public void Register(ClientChannel clientChannel) { var consumer = _consumerDict.AddOrUpdate(clientChannel.ClientId, key => { _logger.InfoFormat("Consumer added into group. groupName:{0}, consumerId:{1}, remotingAddress:{2}", _groupName, clientChannel.ClientId, clientChannel.Channel.RemoteEndPoint.ToString()); return(clientChannel); }, (key, old) => clientChannel); consumer.LastUpdateTime = DateTime.Now; }
public void Register(ClientChannel clientChannel) { var consumer = _consumerDict.AddOrUpdate(clientChannel.ClientId, key => { _logger.InfoFormat("Consumer registered. consumerGroup:{0}, consumerId:{1}, remotingEndPoint:{2}", _groupName, clientChannel.ClientId, clientChannel.Channel.RemotingEndPoint); return(clientChannel); }, (key, old) => clientChannel); consumer.LastUpdateTime = DateTime.Now; }
public void RegisterConsumer(string groupName, ClientChannel clientChannel, IEnumerable<string> subscriptionTopics) { var consumerGroup = _consumerGroupDict.GetOrAdd(groupName, new ConsumerGroup(groupName)); consumerGroup.GetOrAddChannel(clientChannel); consumerGroup.UpdateChannelSubscriptionTopics(clientChannel, subscriptionTopics); }
public void GetOrAddChannel(ClientChannel clientChannel) { var currentChannel = _consumerChannelDict.GetOrAdd(clientChannel.Channel.RemotingAddress, clientChannel); currentChannel.LastUpdateTime = DateTime.Now; }
public void UpdateChannelSubscriptionTopics(ClientChannel clientChannel, IEnumerable <string> subscriptionTopics) { _clientSubscriptionTopicDict.AddOrUpdate(clientChannel.ClientId, subscriptionTopics, (key, old) => subscriptionTopics); }
public void UpdateChannelSubscriptionTopics(ClientChannel clientChannel, IEnumerable<string> subscriptionTopics) { _clientSubscriptionTopicDict.AddOrUpdate(clientChannel.ClientId, subscriptionTopics, (key, old) => subscriptionTopics); }