Beispiel #1
0
 /// <summary>
 /// Shuts the specified connection.
 /// </summary>
 /// <param name="connection">The connection.</param>
 public void Shut(Connection connection)
 {
     if (State == DispatcherState.DS_RUNNING)
     {
         logger.Debug(m => m("Dispatcher: Stopping connection {0}", connection.Name));
         Consumers.Where(consumer => consumer.Name == connection.Name).Each((consumer) => consumer.Shut());
     }
 }
Beispiel #2
0
 /// <summary>
 /// Shuts the specified subscription.
 /// </summary>
 /// <param name="subscription">The subscription.</param>
 public void Shut(Subscription subscription)
 {
     if (State == DispatcherState.DS_RUNNING)
     {
         s_logger.LogInformation("Dispatcher: Stopping subscription {ChannelName}", subscription.Name);
         var consumersForConnection = Consumers.Where(consumer => consumer.SubscriptionName == subscription.Name).ToArray();
         var noOfConsumers          = consumersForConnection.Length;
         for (int i = 0; i < noOfConsumers; ++i)
         {
             consumersForConnection[i].Shut();
         }
     }
 }
Beispiel #3
0
 /// <summary>
 /// Shuts the specified connection.
 /// </summary>
 /// <param name="connection">The connection.</param>
 public void Shut(Connection connection)
 {
     if (State == DispatcherState.DS_RUNNING)
     {
         _logger.Value.InfoFormat("Dispatcher: Stopping connection {0}", connection.Name);
         var consumersForConnection = Consumers.Where(consumer => consumer.Name == connection.Name).ToArray();
         var noOfConsumers          = consumersForConnection.Length;
         for (int i = 0; i < noOfConsumers; ++i)
         {
             consumersForConnection[i].Shut();
         }
     }
 }
        public void Validate()
        {
            if (ConnConfig == null)
            {
                throw new ArgumentException("Invalid null value", nameof(ConnConfig));
            }

            if (Consumers == null)
            {
                throw new ArgumentException("Invalid null value", nameof(Consumers));
            }

            Consumers = Consumers ?? Assembly.GetEntryAssembly().GetTypes();
            Consumers = Consumers.Where(x => typeof(ConsumerBase).IsAssignableFrom(x) &&
                                        !x.IsInterface && !x.IsAbstract);
        }
Beispiel #5
0
 public IEnumerable <Type> GetCollectedConsumers()
 {
     return(Consumers.Where(c => !IgnoreConsumers.Contains(c)));
 }