Ejemplo n.º 1
0
        public Subscription Subscribe <T>(SubscriptionOption <T> subscriptionOption)
        {
            TryConnectBeforeSubscribing();
            Func <IModel, string, IBasicConsumer> createConsumer = (channel, consumerTag) => _consumerManager.CreateConsumer(channel, subscriptionOption.SubscriptionName, subscriptionOption.MessageHandler, subscriptionOption.BatchSize <= 0 ? (ushort)1 : subscriptionOption.BatchSize);
            var queueName    = (subscriptionOption.RouteFinder ?? _routeFinder).FindQueueName <T>(subscriptionOption.SubscriptionName);
            var prefetchSize = GetProperPrefetchSize(subscriptionOption.QueuePrefetchSize);

            return(CreateSubscription(subscriptionOption.SubscriptionName, queueName, createConsumer, prefetchSize));
        }
Ejemplo n.º 2
0
 public uint GetMessageCount <T>(SubscriptionOption <T> subscriptionOption)
 {
     return(GetMessageCount((subscriptionOption.RouteFinder ?? _routeFinder).FindQueueName <T>(subscriptionOption.SubscriptionName)));
 }