/// <summary> /// Creates a Sink which writes incoming <see cref="ByteString"/>s to an <see cref="Stream"/> created by the given function. /// /// Materializes a <see cref="Task{TResult}"/> of <see cref="IOResult"/> that will be completed with the size of the file (in bytes) at the streams completion, /// and a possible exception if IO operation was not completed successfully. /// /// You can configure the default dispatcher for this Source by changing the "akka.stream.blocking-io-dispatcher" or /// set it for a given Source by using <see cref="ActorAttributes.CreateDispatcher"/>. /// If <paramref name="autoFlush"/> is true the OutputStream will be flushed whenever a byte array is written, defaults to false. /// /// The <see cref="Stream"/> will be closed when the stream flowing into this <see cref="Sink{TIn,TMat}"/> is completed. The <see cref="Sink{TIn,TMat}"/> /// will cancel the stream when the <see cref="Stream"/> is no longer writable. /// </summary> /// <param name="createOutputStream">A function which creates the <see cref="Stream"/> to write to</param> /// <param name="autoFlush">If set to true the <see cref="Stream"/> will be flushed whenever a byte array is written, default is false</param> public static Sink<ByteString, Task<IOResult>> FromOutputStream(Func<Stream> createOutputStream, bool autoFlush = false) { var shape = new SinkShape<ByteString>(new Inlet<ByteString>("OutputStreamSink")); var streamSink = new OutputStreamSink(createOutputStream, DefaultAttributes.OutputStreamSink, shape, autoFlush); return new Sink<ByteString, Task<IOResult>>(streamSink); }
/// <summary> /// TBD /// </summary> /// <param name="ref">TBD</param> /// <param name="onCompleteMessage">TBD</param> /// <param name="attributes">TBD</param> /// <param name="shape">TBD</param> public ActorRefSink(IActorRef @ref, object onCompleteMessage, Attributes attributes, SinkShape <TIn> shape) : base(shape) { _ref = @ref; _onCompleteMessage = onCompleteMessage; _attributes = attributes; }
/// <summary> /// TBD /// </summary> /// <param name="props">TBD</param> /// <param name="attributes">TBD</param> /// <param name="shape">TBD</param> public ActorSubscriberSink(Props props, Attributes attributes, SinkShape <TIn> shape) : base(shape) { _props = props; _attributes = attributes; }
/// <summary> /// TBD /// </summary> /// <param name="attributes">TBD</param> /// <param name="shape">TBD</param> public CancelSink(Attributes attributes, SinkShape <T> shape) : base(shape) { Attributes = attributes; }
/// <summary> /// TBD /// </summary> /// <param name="subscriber">TBD</param> /// <param name="attributes">TBD</param> /// <param name="shape">TBD</param> public SubscriberSink(ISubscriber <TIn> subscriber, Attributes attributes, SinkShape <TIn> shape) : base(shape) { Attributes = attributes; _subscriber = subscriber; }
/// <summary> /// TBD /// </summary> /// <param name="attributes">TBD</param> /// <param name="shape">TBD</param> public FanoutPublisherSink(Attributes attributes, SinkShape <TIn> shape) : base(shape) { Attributes = attributes; }
protected override SinkModule <ByteString, Task <IOResult> > NewInstance(SinkShape <ByteString> shape) => new OutputStreamSink(_createOutput, Attributes, shape, _autoFlush);
protected override SinkModule <ByteString, Task <IOResult> > NewInstance(SinkShape <ByteString> shape) => new FileSink(_f, _fileMode, Attributes, shape);
/// <summary> /// TBD /// </summary> /// <param name="shape">TBD</param> /// <returns>TBD</returns> protected override SinkModule <TIn, IPublisher <TIn> > NewInstance(SinkShape <TIn> shape) => new FanoutPublisherSink <TIn, TStreamBuffer>(Attributes, shape, _onTerminated);
/// <summary> /// TBD /// </summary> /// <param name="attributes">TBD</param> /// <param name="shape">TBD</param> /// <param name="onTerminated">TBD</param> public FanoutPublisherSink(Attributes attributes, SinkShape <TIn> shape, Action onTerminated = null) : base(shape) { Attributes = attributes; _onTerminated = onTerminated; }
public CompletionLatch() { Shape = new SinkShape <MutableElement>(In); }
public static GraphDsl.Builder <TMat> To <TIn, TOut, TMat>(this GraphDsl.ForwardOps <TOut, TMat> ops, SinkShape <TIn> sink) where TIn : TOut { var b = ops.Builder; b.AddEdge(ops.Out, sink.Inlet); return(b); }
public ReverseOps <TIn, T> To <TIn>(SinkShape <TIn> sink) { return(new ReverseOps <TIn, T>(this, sink.Inlet)); }
/// <summary> /// TBD /// </summary> /// <param name="readTimeout">TBD</param> public InputStreamSinkStage(TimeSpan readTimeout) { _readTimeout = readTimeout; Shape = new SinkShape <ByteString>(_in); }
protected override SinkModule <T, TestSubscriber.Probe <T> > NewInstance(SinkShape <T> shape) { return(new ProbeSink <T>(_testKit, _attributes, shape)); }
/// <summary> /// TBD /// </summary> public QueueSink() { Shape = new SinkShape <T>(In); }
private TestSinkStage(GraphStageWithMaterializedValue <SinkShape <T>, TMat> stageUnderTest, TestProbe probe) { _stageUnderTest = stageUnderTest; _probe = probe; Shape = new SinkShape <T>(_in); }
public OutputStreamSink(Func <Stream> createOutput, Attributes attributes, SinkShape <ByteString> shape, bool autoFlush) : base(shape) { _createOutput = createOutput; Attributes = attributes; _autoFlush = autoFlush; }
public IgnoreSink() { Shape = new SinkShape <T>(Inlet); }
public SumTestStage(IActorRef probe) { _probe = probe; Shape = new SinkShape <int>(_inlet); }
public ObservableSinkStage() { Shape = new SinkShape <T>(Inlet); }
/// <summary> /// TBD /// </summary> /// <param name="shape">TBD</param> /// <returns>TBD</returns> protected override SinkModule <TIn, IPublisher <TIn> > NewInstance(SinkShape <TIn> shape) => new FanoutPublisherSink <TIn>(Attributes, shape);
/// <summary> /// TBD /// </summary> /// <param name="shape">TBD</param> /// <returns>TBD</returns> protected override SinkModule <TIn, NotUsed> NewInstance(SinkShape <TIn> shape) => new ActorRefSink <TIn>(_ref, _onCompleteMessage, _attributes, shape);
/// <summary> /// TBD /// </summary> /// <param name="shape">TBD</param> /// <returns>TBD</returns> protected override SinkModule <TIn, NotUsed> NewInstance(SinkShape <TIn> shape) => new SubscriberSink <TIn>(_subscriber, Attributes, shape);
/// <summary> /// TBD /// </summary> /// <param name="shape">TBD</param> protected SinkModule(SinkShape <TIn> shape) { _shape = shape; }
/// <summary> /// TBD /// </summary> /// <param name="shape">TBD</param> /// <returns>TBD</returns> protected override SinkModule <T, NotUsed> NewInstance(SinkShape <T> shape) => new CancelSink <T>(Attributes, shape);
/// <summary> /// TBD /// </summary> public FirstOrDefaultStage() { Shape = new SinkShape <T>(In); }
/// <summary> /// TBD /// </summary> /// <param name="shape">TBD</param> /// <returns>TBD</returns> protected override SinkModule <TIn, IActorRef> NewInstance(SinkShape <TIn> shape) => new ActorSubscriberSink <TIn>(_props, _attributes, shape);
/// <summary> /// TBD /// </summary> public SeqStage() { Shape = new SinkShape <T>(In); }
/// <summary> /// TBD /// </summary> /// <param name="shape">TBD</param> /// <returns>TBD</returns> protected abstract SinkModule <TIn, TMat> NewInstance(SinkShape <TIn> shape);
public ProbeSink(TestKitBase testKit, Attributes attributes, SinkShape <T> shape) : base(shape) { _testKit = testKit; _attributes = attributes; }