public IDisposable RespondAsync <TRequest, TResponse>(Func <TRequest, Task <TResponse> > responder, Action <IResponderConfiguration> configure) where TRequest : class where TResponse : class { Preconditions.CheckNotNull(responder, "responder"); Preconditions.CheckNotNull(configure, "configure"); return(rpc.Respond(responder, configure)); }
public virtual IDisposable RespondAsync <TRequest, TResponse>(Func <TRequest, Task <TResponse> > responder) where TRequest : class where TResponse : class { Preconditions.CheckNotNull(responder, "responder"); return(rpc.Respond(responder)); }
public virtual void RespondAsync <TRequest, TResponse>(Func <TRequest, Task <TResponse> > responder) where TRequest : class where TResponse : class { Preconditions.CheckNotNull(responder, "responder"); rpc.Respond(responder); }
/// <summary> /// 메세지 응답 /// </summary> /// <param name="responder">메세지 응답시 실행될 Func</param> /// <param name="queueName">메세지 큐 이름</param> public IDisposable Reply(Func <byte[], byte[]> responder, string queueName) { Preconditions.CheckNotNull(responder, "responder"); Func <byte[], Task <byte[]> > taskResponder = request => Task <byte[]> .Factory.StartNew(_ => responder(request), null); return(rpc.Respond(taskResponder, configure => { }, queueName)); }
/// <summary> /// Set up a responder for an RPC service. /// </summary> /// <typeparam name="TRequest">The request type</typeparam> /// <typeparam name="TResponse">The response type</typeparam> /// <param name="rpc">The rpc instance</param> /// <param name="responder">A function that performs the response</param> /// <param name="cancellationToken">The cancellation token</param> public static IDisposable Respond <TRequest, TResponse>( this IRpc rpc, Func <TRequest, Task <TResponse> > responder, CancellationToken cancellationToken = default ) { Preconditions.CheckNotNull(rpc, "rpc"); return(rpc.Respond(responder, c => { }, cancellationToken)); }
/// <summary> /// Set up a responder for an RPC service. /// </summary> /// <typeparam name="TRequest">The request type</typeparam> /// <typeparam name="TResponse">The response type</typeparam> /// <param name="rpc">The rpc instance</param> /// <param name="responder">A function that performs the response</param> /// <param name="configure">A function that performs the configuration</param> /// <param name="cancellationToken">The cancellation token</param> public static IDisposable Respond <TRequest, TResponse>( this IRpc rpc, Func <TRequest, Task <TResponse> > responder, Action <IResponderConfiguration> configure, CancellationToken cancellationToken = default ) { Preconditions.CheckNotNull(rpc, "rpc"); return(rpc.Respond <TRequest, TResponse>((r, c) => responder(r), configure, cancellationToken)); }
/// <summary> /// Set up a responder for an RPC service. /// </summary> /// <typeparam name="TRequest">The request type</typeparam> /// <typeparam name="TResponse">The response type</typeparam> /// <param name="rpc">The rpc instance</param> /// <param name="responder">A function that performs the response</param> /// <param name="cancellationToken">The cancellation token</param> public static IDisposable Respond <TRequest, TResponse>( this IRpc rpc, Func <TRequest, TResponse> responder, CancellationToken cancellationToken = default ) { Preconditions.CheckNotNull(rpc, "rpc"); var asyncResponder = TaskHelpers.FromFunc <TRequest, TResponse>((m, c) => responder(m)); return(rpc.Respond(asyncResponder, c => { }, cancellationToken)); }