public SagaStepConfiguration(ISagaVersion version, int index, Predicate <TEvent>?customValidation)
        {
            Version = version ?? throw new ArgumentNullException(nameof(version));
            Index   = index;

            _customValidation = customValidation;
        }
Beispiel #2
0
        public SagaStepAdapter(ISagaVersion sagaVersion, int index, ISagaStep <TEvent> step)
        {
            Version = sagaVersion ?? throw new ArgumentNullException(nameof(sagaVersion));
            Index   = index;

            _step = step ?? throw new ArgumentNullException(nameof(step));
        }
Beispiel #3
0
        public int CompareTo(ISagaVersion other)
        {
            if (!(other is SagaVersion converted))
            {
                return(Version.CompareTo(new Version(other.Major, other.Minor, other.Patch)));
            }

            return(Version.CompareTo(converted.Version));
        }
Beispiel #4
0
 public SagaReference(ISagaVersion sagaVersion, int stepIndex, SagaMessageType messageType, Guid referenceId, Guid transactionId, object?message = null)
 {
     Version       = sagaVersion;
     StepIndex     = stepIndex;
     MessageType   = messageType;
     ReferenceId   = referenceId;
     TransactionId = transactionId;
     Message       = message;
 }
Beispiel #5
0
        public void AddSteps_VersionIsNull_ThrowArgumentNull()
        {
            // Arrange
            var          sagaProcessor  = CreateSagaProcessor();
            var          configurations = new List <ISagaStepConfiguration>();
            ISagaVersion version        = null;

            // Assert
            Assert.Throws <ArgumentNullException>(() => sagaProcessor.AddSteps(version, configurations));
        }
Beispiel #6
0
        public void AddSteps(ISagaVersion version, IList <ISagaStepConfiguration> configurations)
        {
            if (version is null)
            {
                throw new ArgumentNullException(nameof(version));
            }

            if (configurations is null)
            {
                throw new ArgumentNullException(nameof(configurations));
            }

            if (_steps.ContainsKey(version))
            {
                _steps[version] = configurations;

                _logger.LogWarning($"Version {version} was already added. The given configuration is now replaced.");
            }
            else
            {
                _steps.Add(version, configurations);
            }
        }
        public SagaVersionBuilder(ISagaVersion version)
        {
            Version = version ?? throw new ArgumentNullException(nameof(version));

            Steps = new List <ISagaStepConfiguration>();
        }