protected virtual IPipelineSink <TMessage> CreateSink <V>(DataEvent <TSaga, V> dataEvent, ISagaPolicy <TSaga, V> policy, Expression <Func <TSaga, V, bool> > selector)
            where V : class
        {
            var sink = new PropertySagaStateMachineMessageSink <TSaga, V>(_context, _bus, _repository, policy, selector, dataEvent);

            if (sink == null)
            {
                throw new ConfigurationException("Could not build the message sink: " + typeof(PropertySagaStateMachineMessageSink <TSaga, V>).ToFriendlyName());
            }

            return((IPipelineSink <TMessage>)sink);
        }
        public ISagaMessageSink <TSaga, TMessage> CreateSink()
        {
            var sink = new PropertySagaStateMachineMessageSink <TSaga, TMessage>(_sagaRepository, _policy,
                                                                                 _selector, _dataEvent);

            if (sink == null)
            {
                throw new ConfigurationException("Could not build the message sink: " +
                                                 typeof(PropertySagaStateMachineMessageSink <TSaga, TMessage>).ToFriendlyName());
            }
            return(sink);
        }
Пример #3
0
        public bool Inspect <TComponent, TMessage>(PropertySagaStateMachineMessageSink <TComponent, TMessage> sink)
            where TMessage : class
            where TComponent : SagaStateMachine <TComponent>, ISaga
        {
            string policyDescription = GetPolicy(sink.Policy);
            string expression        = sink.Selector.ToString();

            Append(string.Format("{0} Saga {1} ({2}): {3}", policyDescription, GetComponentName <TComponent>(),
                                 GetMessageName <TMessage>(), expression));

            return(true);
        }
Пример #4
0
        public bool Inspect <TComponent, TMessage>(PropertySagaStateMachineMessageSink <TComponent, TMessage> sink)
            where TMessage : class
            where TComponent : SagaStateMachine <TComponent>, ISaga
        {
            Type componentType = typeof(TComponent);

            string componentName = componentType.IsGenericType ? componentType.GetGenericTypeDefinition().FullName : componentType.FullName;

            string policyDescription = GetPolicy(sink.Policy);
            string expression        = sink.Selector.ToString();

            Append(string.Format("{0} Saga {1} ({2}): {3}", policyDescription, componentName, typeof(TMessage).Name, expression));

            return(true);
        }