public Task RegisterRpcHandlerAsync(IRequestMatcher pattern, Func <Message, CancellationToken, Task <Message> > handler, RouteExecution execution = RouteExecution.Synchronous, RouteMode mode = RouteMode.Capture, CancellationToken cancellationToken = default)
 {
     return(_policy.ExecuteAsync((_, registerPolicyToken) => _registration.RegisterRpcHandlerAsync(
                                     pattern,
                                     (message, handlerToken) => _policy.AsAsyncPolicy <Message>().ExecuteAsync((__, handlerPolicyToken) => handler(message, handlerPolicyToken), new Context(), handlerToken),
                                     execution,
                                     mode,
                                     registerPolicyToken
                                     ), new Context(), cancellationToken));
 }
Beispiel #2
0
 public Task <Message> CallAsync(Message message, CancellationToken cancellationToken = default)
 {
     return(_policy
            .AsAsyncPolicy <Message>()
            .ExecuteAsync((_, policyToken) => _sender.CallAsync(message, policyToken), new Context(), cancellationToken));
 }