Beispiel #1
0
        IEnumerable <Action <IConsumeContext <TMessage> > > IConsumerFactory <TConsumer> .GetConsumer <TMessage>(IConsumeContext <TMessage> context,
                                                                                                                 InstanceHandlerSelector <TConsumer, TMessage> selector)
        {
            using (ICodeSwitchContainerScope innerScope = CreateContainerScope(context))
            {
                TConsumer consumer;
                if (!innerScope.TryResolve(out consumer))
                {
                    throw new ConfigurationException(string.Format("The consumer type {0} could not be resolved from the container.",
                                                                   typeof(TConsumer).ToShortTypeName()));
                }

                foreach (var handler in selector(consumer, context))
                {
                    yield return(handler);
                }
            }
        }
Beispiel #2
0
 public ContextSagaRepository(ICodeSwitchContainerScope scope, ISagaRepository <TSaga> repository)
 {
     _scope      = scope;
     _repository = repository;
 }
Beispiel #3
0
 public ContextConsumerFactory(ICodeSwitchContainerScope scope)
 {
     _scope = scope;
 }