public ReceiveEndpointDispatcher(IReceiveEndpointDispatcherFactory factory, IEndpointNameFormatter formatter)
        {
            IReceiveEndpointDispatcher CreateDispatcher(Type dispatcherType)
            {
                var dispatcherFactory = (ITypeReceiveEndpointDispatcherFactory)Activator.CreateInstance(dispatcherType);

                return(dispatcherFactory.Create(factory, formatter));
            }

            if (typeof(T).HasInterface <IConsumer>())
            {
                _dispatcher = CreateDispatcher(typeof(ConsumerReceiveEndpointDispatcher <>).MakeGenericType(typeof(T)));
            }
            else if (typeof(T).HasInterface <ISaga>())
            {
                _dispatcher = CreateDispatcher(typeof(SagaReceiveEndpointDispatcher <>).MakeGenericType(typeof(T)));
            }
            else if (typeof(T).ClosesType(typeof(IExecuteActivity <>), out Type[] arguments))
예제 #2
0
        public IReceiveEndpointDispatcher Create(IReceiveEndpointDispatcherFactory factory, IEndpointNameFormatter formatter)
        {
            var queueName = formatter.Saga <T>();

            return(factory.CreateSagaReceiver <T>(queueName));
        }
 public ReceiveEndpointDispatcher(IReceiveEndpointDispatcherFactory factory)
     : this(factory, DefaultEndpointNameFormatter.Instance)
 {
 }
        public IReceiveEndpointDispatcher Create(IReceiveEndpointDispatcherFactory factory, IEndpointNameFormatter formatter)
        {
            var queueName = formatter.ExecuteActivity <TActivity, TArguments>();

            return(factory.CreateExecuteActivityReceiver <TActivity>(queueName));
        }