예제 #1
0
        public ConsumerWorkflow <TState> WithEncryption(int?maxDoPOverride = null, bool?ensureOrdered = null, int?bufferSizeOverride = null)
        {
            Guard.AgainstNull(_encryptionProvider, nameof(_encryptionProvider));
            var executionOptions = GetExecuteStepOptions(maxDoPOverride, ensureOrdered, bufferSizeOverride);

            _encryptBlock = BlockBuilders.GetByteManipulationTransformBlock <TState>(_encryptionProvider.Encrypt, executionOptions, true, x => !x.ReceivedData.Encrypted);
            return(this);
        }
예제 #2
0
        public ConsumerWorkflow <TState> WithFinalization(Action <TState> action, int?maxDoPOverride = null, bool?ensureOrdered = null, int?bufferSizeOverride = null)
        {
            Guard.AgainstNull(_encryptionProvider, nameof(_encryptionProvider));
            var executionOptions = GetExecuteStepOptions(maxDoPOverride, ensureOrdered, bufferSizeOverride);

            _finalization = BlockBuilders.GetWrappedActionBlock <TState>(action, executionOptions);
            return(this);
        }
예제 #3
0
        public ConsumerWorkflow <TState> WithCreateSendLetter(Func <TState, Task <TState> > createLetter, int?maxDoPOverride = null, bool?ensureOrdered = null, int?bufferSizeOverride = null)
        {
            Guard.AgainstNull(_compressProvider, nameof(_compressProvider));
            var executionOptions = GetExecuteStepOptions(maxDoPOverride, ensureOrdered, bufferSizeOverride);

            _createSendLetter = BlockBuilders.GetWrappedTransformBlock <TState>(createLetter, executionOptions);
            return(this);
        }
예제 #4
0
        public ConsumerWorkflow <TState> AddStep(Func <TState, Task <TState> > suppliedStep, int?maxDoPOverride = null, bool?ensureOrdered = null, int?bufferSizeOverride = null)
        {
            Guard.AgainstNull(_encryptionProvider, nameof(_encryptionProvider));
            var executionOptions = GetExecuteStepOptions(maxDoPOverride, ensureOrdered, bufferSizeOverride);

            _suppliedTransforms.Add(BlockBuilders.GetWrappedTransformBlock <TState>(suppliedStep, executionOptions));
            return(this);
        }
예제 #5
0
        public ConsumerWorkflow <TState> WithDecompressionStep(int?maxDoPOverride = null, bool?ensureOrdered = null, int?bufferSizeOverride = null)
        {
            Guard.AgainstNull(_compressProvider, nameof(_compressProvider));
            var executionOptions = GetExecuteStepOptions(maxDoPOverride, ensureOrdered, bufferSizeOverride);

            _decompressBlock = BlockBuilders.GetByteManipulationTransformBlock <TState>(_compressProvider.DecompressAsync, executionOptions, false, x => x.ReceivedData.Compressed);
            return(this);
        }
예제 #6
0
        public ConsumerWorkflow <TState> WithDeserializeStep(Func <ReceivedData, TState> deserialize, int?maxDoPOverride = null, bool?ensureOrdered = null, int?bufferSizeOverride = null)
        {
            Guard.AgainstNull(deserialize, nameof(deserialize));
            var executionOptions = GetExecuteStepOptions(maxDoPOverride, ensureOrdered, bufferSizeOverride);

            _deserializeBlock = BlockBuilders.GetStateTransformBlock(deserialize, executionOptions);
            return(this);
        }
예제 #7
0
        public ConsumerWorkflow <TState> WithErrorHandling(Action <TState> action, int bufferCapacity, int?maxDoPOverride = null, bool?ensureOrdered = null)
        {
            _errorBuffer = new BufferBlock <TState>(new DataflowBlockOptions {
                BoundedCapacity = bufferCapacity > 0 ? bufferCapacity : 1000
            });
            var executionOptions = GetExecuteStepOptions(maxDoPOverride, ensureOrdered, bufferCapacity);

            _errorAction = BlockBuilders.GetWrappedActionBlock(action, executionOptions);
            return(this);
        }