/// <summary> /// TBD /// </summary> /// <param name="context">TBD</param> /// <param name="task">TBD</param> /// <returns>TBD</returns> public override IPublisher <ByteString> Create(MaterializationContext context, out Task <IOResult> task) { var materializer = ActorMaterializerHelper.Downcast(context.Materializer); var ioResultPromise = new TaskCompletionSource <IOResult>(); IPublisher <ByteString> pub; try { // can throw, i.e. FileNotFound var inputStream = _createInputStream(); var props = InputStreamPublisher .Props(inputStream, ioResultPromise, _chunkSize) .WithDispatcher(context .EffectiveAttributes .GetMandatoryAttribute <ActorAttributes.Dispatcher>() .Name); var actorRef = materializer.ActorOf(context, props); pub = new ActorPublisherImpl <ByteString>(actorRef); } catch (Exception ex) { ioResultPromise.TrySetException(ex); pub = new ErrorPublisher <ByteString>(ex, Attributes.GetNameOrDefault("inputStreamSource")); } task = ioResultPromise.Task; return(pub); }
// Start is called before the first frame update void Start() { Debug.Log("Super Publisher started"); errorPublisher = this.gameObject.AddComponent <ErrorPublisher>(); errorPublisher.Topic = topicError; warningPublisher = this.gameObject.AddComponent <WarningPublisher>(); warningPublisher.Topic = topicWarning; infoPublisher = this.gameObject.AddComponent <InfoPublisher>(); infoPublisher.Topic = topicInfo; }