public Task LogAsync <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter) { return(_loggingActors.Ask(new LogItemBuilder() .SetLogLevel(logLevel) .SetEventId(eventId) .SetState(state) .SetException(exception) .SetFormatter((o, ex) => formatter?.Invoke((TState)o, ex)) .Build())); }
public static TAnswer AskAndWait <TAnswer>(this ICanTell self, object message, TimeSpan timeout) { var task = self.Ask <TAnswer>(message, timeout); task.Wait(); return(task.Result); }
//when asking from outside of an actor, we need to pass a system, so the FutureActor can register itself there and be resolvable for local and remote calls /// <summary> /// TBD /// </summary> /// <param name="self">TBD</param> /// <param name="message">TBD</param> /// <param name="timeout">TBD</param> /// <returns>TBD</returns> public static async Task <object> AskObservable <TMessage>(this ICanTell self, TMessage message) where TMessage : notnull { var activity = Activity.Current; var res = await self.Ask <ObservableEnvelope>(new ObservableEnvelope <TMessage>(message, activity.Context)); return(res.Body); }
private void LogResultPickedUp(RunnableScriptObject message, ICanTell statusUpdateActor) { Task t = statusUpdateActor.Ask(new UpdateRunStatusAsPickedUpRequestMessage { ScriptId = message.RunnableScriptId }); t.Wait(); }
/// <summary> /// TBD /// </summary> /// <typeparam name="T">TBD</typeparam> /// <param name="self">TBD</param> /// <param name="message">TBD</param> /// <param name="cancellationToken">TBD</param> /// <returns>TBD</returns> public static Task <T> Ask <T>(this ICanTell self, object message, CancellationToken cancellationToken) { return(self.Ask <T>(message, null, cancellationToken)); }
/// <summary> /// TBD /// </summary> /// <typeparam name="T">TBD</typeparam> /// <param name="self">TBD</param> /// <param name="message">TBD</param> /// <param name="timeout">TBD</param> /// <returns>TBD</returns> public static Task <T> Ask <T>(this ICanTell self, object message, TimeSpan?timeout = null) { return(self.Ask <T>(message, timeout, CancellationToken.None)); }
/// <summary> /// TBD /// </summary> /// <param name="self">TBD</param> /// <param name="message">TBD</param> /// <param name="timeout">TBD</param> /// <param name="cancellationToken">TBD</param> /// <returns>TBD</returns> public static Task <object> Ask(this ICanTell self, object message, TimeSpan?timeout, CancellationToken cancellationToken) { return(self.Ask <object>(message, timeout, cancellationToken)); }
//when asking from outside of an actor, we need to pass a system, so the FutureActor can register itself there and be resolvable for local and remote calls public static Task <object> Ask(this ICanTell self, object message, TimeSpan?timeout = null) { return(self.Ask <object>(message, timeout)); }
protected async Task <ICanTell> GetActor <T>() where T : ActorBase { var result = await _addressBook.Ask <AddressBook.Found>(new AddressBook.Get(typeof(T))); return(result.Ref); }