Exemplo n.º 1
0
        public async Task UpdateSubscriptionsAsync(IEnumerable <SubscriptionsForType> subscriptionsForTypes)
        {
            var subscriptions = subscriptionsForTypes as SubscriptionsForType[] ?? subscriptionsForTypes.ToArray();

            if (subscriptions.Length == 0)
            {
                return;
            }

            var command = new UpdatePeerSubscriptionsForTypesCommand(_bus.PeerId, DateTime.Now, subscriptions);

            foreach (var peer in _peers)
            {
                try
                {
                    var result = await _bus.Send(command);

                    return;
                }
                catch (Exception ex)
                {
                    _logger.LogError(ex, "Exception");
                }
            }
        }
Exemplo n.º 2
0
        public void Handle(UpdatePeerSubscriptionsForTypesCommand message)
        {
            if (message.SubscriptionsForTypes == null || message.SubscriptionsForTypes.Length == 0)
            {
                return;
            }

            _bus.Publish(new PeerSubscriptionsForTypesUpdated(message.PeerId, message.TimestampUtc, message.SubscriptionsForTypes));
        }
Exemplo n.º 3
0
 public void Handle(UpdatePeerSubscriptionsForTypesCommand message)
 {
     _bus.Publish(new PeerSubscriptionsForTypesUpdated(message.PeerId, message.TimestampUtc, message.SubscriptionsForTypes));
 }