Пример #1
0
        public static SubscriptionBuilder AddDefaultSubscription <TEvent>(
            this SubscriptionBuilder subscriptionBuilder,
            Func <IntegrationEvent <TEvent>, Task> consumer,
            Func <IntegrationEvent <TEvent>, Exception, Task> deadLetterCallback = null) where TEvent : class
        {
            var lambdaConsumer = new LambdaConsumer <TEvent>(consumer);

            subscriptionBuilder.AddDefaultSubscription(() => lambdaConsumer, deadLetterCallback);
            return(subscriptionBuilder);
        }
        public static Tuple <ISubscriber, SubscriptionBuilder> AddSubscription <TEvent>(
            this Tuple <ISubscriber, SubscriptionBuilder> subscriber,
            string eventType,
            Func <IntegrationEvent <TEvent>, Task> consumer,
            Func <IntegrationEvent <TEvent>, Exception, Task> deadLetterCallback = null) where TEvent : class
        {
            var lambdaConsumer = new LambdaConsumer <TEvent>(consumer);

            subscriber.Item2.AddSubscription(eventType, () => lambdaConsumer, deadLetterCallback);
            return(subscriber);
        }