private ActorMaterializerSettings Copy( int?initialInputBufferSize = null, int?maxInputBufferSize = null, string dispatcher = null, Decider supervisionDecider = null, StreamSubscriptionTimeoutSettings subscriptionTimeoutSettings = null, StreamRefSettings streamRefSettings = null, bool?isDebugLogging = null, int?outputBurstLimit = null, bool?isFuzzingMode = null, bool?isAutoFusing = null, int?maxFixedBufferSize = null, int?syncProcessingLimit = null) { return(new ActorMaterializerSettings( initialInputBufferSize ?? InitialInputBufferSize, maxInputBufferSize ?? MaxInputBufferSize, dispatcher ?? Dispatcher, supervisionDecider ?? SupervisionDecider, subscriptionTimeoutSettings ?? SubscriptionTimeoutSettings, streamRefSettings ?? StreamRefSettings, isDebugLogging ?? IsDebugLogging, outputBurstLimit ?? OutputBurstLimit, isFuzzingMode ?? IsFuzzingMode, isAutoFusing ?? IsAutoFusing, maxFixedBufferSize ?? MaxFixedBufferSize, syncProcessingLimit ?? SyncProcessingLimit)); }
/// <summary> /// Decides how exceptions from application code are to be handled, unless /// overridden for specific flows of the stream operations with /// <see cref="ActorAttributes.SupervisionStrategy"/> /// </summary> /// <param name="decider">TBD</param> /// <returns>TBD</returns> public ActorMaterializerSettings WithSupervisionStrategy(Decider decider) { if (decider.Equals(SupervisionDecider)) { return(this); } return(Copy(supervisionDecider: decider)); }
/// <summary> /// TBD /// </summary> /// <param name="initialInputBufferSize">TBD</param> /// <param name="maxInputBufferSize">TBD</param> /// <param name="dispatcher">TBD</param> /// <param name="supervisionDecider">TBD</param> /// <param name="subscriptionTimeoutSettings">TBD</param> /// <param name="isDebugLogging">TBD</param> /// <param name="outputBurstLimit">TBD</param> /// <param name="isFuzzingMode">TBD</param> /// <param name="isAutoFusing">TBD</param> /// <param name="maxFixedBufferSize">TBD</param> /// <param name="syncProcessingLimit">TBD</param> public ActorMaterializerSettings(int initialInputBufferSize, int maxInputBufferSize, string dispatcher, Decider supervisionDecider, StreamSubscriptionTimeoutSettings subscriptionTimeoutSettings, bool isDebugLogging, int outputBurstLimit, bool isFuzzingMode, bool isAutoFusing, int maxFixedBufferSize, int syncProcessingLimit = DefaultlMaxFixedbufferSize) { InitialInputBufferSize = initialInputBufferSize; MaxInputBufferSize = maxInputBufferSize; Dispatcher = dispatcher; SupervisionDecider = supervisionDecider; SubscriptionTimeoutSettings = subscriptionTimeoutSettings; IsDebugLogging = isDebugLogging; OutputBurstLimit = outputBurstLimit; IsFuzzingMode = isFuzzingMode; IsAutoFusing = isAutoFusing; MaxFixedBufferSize = maxFixedBufferSize; SyncProcessingLimit = syncProcessingLimit; }
/// <summary> /// TBD /// </summary> /// <param name="initialInputBufferSize">TBD</param> /// <param name="maxInputBufferSize">TBD</param> /// <param name="dispatcher">TBD</param> /// <param name="supervisionDecider">TBD</param> /// <param name="subscriptionTimeoutSettings">TBD</param> /// <param name="streamRefSettings">TBD</param> /// <param name="isDebugLogging">TBD</param> /// <param name="outputBurstLimit">TBD</param> /// <param name="isFuzzingMode">TBD</param> /// <param name="isAutoFusing">TBD</param> /// <param name="maxFixedBufferSize">TBD</param> /// <param name="blockingIoDispatcher">TBD</param> /// <param name="syncProcessingLimit">TBD</param> public ActorMaterializerSettings( int initialInputBufferSize, int maxInputBufferSize, string dispatcher, Decider supervisionDecider, StreamSubscriptionTimeoutSettings subscriptionTimeoutSettings, StreamRefSettings streamRefSettings, bool isDebugLogging, int outputBurstLimit, bool isFuzzingMode, bool isAutoFusing, int maxFixedBufferSize, int syncProcessingLimit = DefaultMaxFixedBufferSize) { if (initialInputBufferSize <= 0) { throw new ArgumentException($"{nameof(initialInputBufferSize)} must be > 0", nameof(initialInputBufferSize)); } if (syncProcessingLimit <= 0) { throw new ArgumentException($"{nameof(syncProcessingLimit)} must be > 0", nameof(syncProcessingLimit)); } if (maxInputBufferSize <= 0) { throw new ArgumentException($"{nameof(maxInputBufferSize)} must be > 0", nameof(maxInputBufferSize)); } if ((maxInputBufferSize & (maxInputBufferSize - 1)) != 0) { throw new ArgumentException($"{nameof(maxInputBufferSize)} must be a power of two", nameof(maxInputBufferSize)); } if (initialInputBufferSize > maxInputBufferSize) { throw new ArgumentException($"initialInputBufferSize({initialInputBufferSize}) must be <= maxInputBufferSize({maxInputBufferSize})"); } InitialInputBufferSize = initialInputBufferSize; MaxInputBufferSize = maxInputBufferSize; Dispatcher = dispatcher; SupervisionDecider = supervisionDecider; SubscriptionTimeoutSettings = subscriptionTimeoutSettings; IsDebugLogging = isDebugLogging; OutputBurstLimit = outputBurstLimit; IsFuzzingMode = isFuzzingMode; IsAutoFusing = isAutoFusing; MaxFixedBufferSize = maxFixedBufferSize; SyncProcessingLimit = syncProcessingLimit; StreamRefSettings = streamRefSettings; }
protected BaseSingleSourceLogic(SourceShape <TMessage> shape, Attributes attributes, Func <BaseSingleSourceLogic <K, V, TMessage>, IMessageBuilder <K, V, TMessage> > messageBuilderFactory) : base(shape) { _shape = shape; _messageBuilder = messageBuilderFactory(this); Control = new BaseSingleSourceControl(_shape, Complete, SetKeepGoing, GetAsyncCallback, PerformShutdown); var supervisionStrategy = attributes.GetAttribute <ActorAttributes.SupervisionStrategy>(null); _decider = supervisionStrategy != null ? supervisionStrategy.Decider : Deciders.ResumingDecider; SetHandler(shape.Outlet, onPull: Pump, onDownstreamFinish: PerformShutdown); }
private TestSubscriber.ManualProbe <int> WhenFailedScan(ICollection <int> elements, int zero, Exception exception = null, Decider decider = null) { exception = exception ?? new Exception("boom"); decider = decider ?? Deciders.StoppingDecider; return(Source.From(elements) .ScanAsync(zero, (i, i1) => { if (i1 >= 0) { return Task.FromResult(i + i1); } throw exception; }) .WithAttributes(ActorAttributes.CreateSupervisionStrategy(decider)) .RunWith(this.SinkProbe <int>(), Materializer) .Request(elements.Count + 1) .ExpectNext(zero)); }
/// <summary> /// TBD /// </summary> /// <param name="decider">TBD</param> /// <returns>TBD</returns> public ActorMaterializerSettings WithSupervisionStrategy(Decider decider) { return(new ActorMaterializerSettings(InitialInputBufferSize, MaxInputBufferSize, Dispatcher, decider, SubscriptionTimeoutSettings, IsDebugLogging, OutputBurstLimit, IsFuzzingMode, IsAutoFusing, MaxFixedBufferSize, SyncProcessingLimit)); }
private TestSubscriber.ManualProbe <string> WhenNullElement(ICollection <string> elements, string zero, Decider decider = null) { decider = decider ?? Deciders.StoppingDecider; return(Source.From(elements) .ScanAsync(zero, (i, i1) => Task.FromResult(i1 != "null" ? i1 : null)) .WithAttributes(ActorAttributes.CreateSupervisionStrategy(decider)) .RunWith(this.SinkProbe <string>(), Materializer) .Request(elements.Count + 1) .ExpectNext(zero)); }
public OneToManyTestStage(Decider decider, bool absorbTermination) { _decider = decider; _absorbTermination = absorbTermination; _buffer = new Queue <int>(); }