Esempio n. 1
0
 public IThreadListenerBuilder <TRequest, TResponse> TransformRequestTo <TTransformed>(string sourceTopic, Func <TRequest, TTransformed> transform)
 {
     Assert.ArgumentNotNull(transform, nameof(transform));
     return(Invoke(request =>
     {
         var transformed = transform(request);
         var waiter = _messageBus.Request <TTransformed, TResponse>(sourceTopic, transformed);
         waiter.WaitForResponse();
         waiter.ThrowExceptionIfError();
         return waiter.GetResponse();
     }));
 }
Esempio n. 2
0
 /// <summary>
 /// Make a request of the given type on the default channel
 /// </summary>
 /// <typeparam name="TRequest">The type of request object</typeparam>
 /// <typeparam name="TResponse">The type of response object</typeparam>
 /// <param name="messageBus">The message bus</param>
 /// <param name="requestPayload">The request object, which represents the input arguments to the RPC</param>
 /// <returns>A token representing the subscription which, when disposed, cancels the subscription</returns>
 public static IRequest <TResponse> Request <TRequest, TResponse>(this IReqResBus messageBus, TRequest requestPayload)
 {
     Assert.ArgumentNotNull(messageBus, nameof(messageBus));
     return(messageBus.Request <TRequest, TResponse>(string.Empty, requestPayload));
 }
 public IRequest <TResponse> Request(TRequest request)
 {
     return(_messageBus.Request <TRequest, TResponse>(request));
 }