Akka.Streams.Implementation.IO.FileSubscriber.Props C# (CSharp) Method

Props() public static method

public static Props ( FileInfo f, TaskCompletionSource completionPromise, int bufferSize, FileMode fileMode ) : Props
f System.IO.FileInfo
completionPromise TaskCompletionSource
bufferSize int
fileMode FileMode
return Props
        public static Props Props(FileInfo f, TaskCompletionSource<IOResult> completionPromise, int bufferSize, FileMode fileMode)
        {
            if(bufferSize <= 0)
                throw new ArgumentException("Buffer size muste be > 0");

            return Actor.Props.Create(()=> new FileSubscriber(f, completionPromise, bufferSize, fileMode)).WithDeploy(Deploy.Local);
        }

Usage Example

Ejemplo n.º 1
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="context">TBD</param>
        /// <param name="materializer">TBD</param>
        /// <returns>TBD</returns>
        public override object Create(MaterializationContext context, out Task <IOResult> materializer)
        {
            var mat      = ActorMaterializerHelper.Downcast(context.Materializer);
            var settings = mat.EffectiveSettings(context.EffectiveAttributes);

            var ioResultPromise = new TaskCompletionSource <IOResult>();
            var props           = FileSubscriber.Props(_f, ioResultPromise, settings.MaxInputBufferSize, _fileMode);
            var dispatcher      = context.EffectiveAttributes.GetAttribute(DefaultAttributes.IODispatcher.AttributeList.First()) as ActorAttributes.Dispatcher;

            var actorRef = mat.ActorOf(context, props.WithDispatcher(dispatcher.Name));

            materializer = ioResultPromise.Task;
            return(new ActorSubscriberImpl <ByteString>(actorRef));
        }
All Usage Examples Of Akka.Streams.Implementation.IO.FileSubscriber::Props