public Task HandlePostInfo(InfoEntryRequest request) { var translatedRequest = new SearchInsertRequest { Kind = "entry", Id = request.Id, Fields = new Dictionary <string, string> { { "User", request.User }, { "Text", request.Text }, } }; return(_sender.SendAsync(translatedRequest)); }
public async Task SendAsync(Message message, CancellationToken cancellationToken = default) { var trace = Trace.Current.Child(); var newMessage = InjectTracing(message, trace); trace.Record(Annotations.ClientSend()); trace.Record(Annotations.ServiceName(_serviceName)); trace.Record(Annotations.Event("TODO")); try { await _sender.SendAsync(newMessage, cancellationToken); trace.Record(Annotations.ClientRecv()); } catch (Exception ex) { trace.Record(Annotations.Tag("error", ex.Message)); trace.Record(Annotations.LocalOperationStop()); throw; } }
public async Task <PostEntryResponse> HandlePostEntryAsync(PostEntryRequest message) { var saveResponse = await _sender.CallAsync <SaveEntryResponse>(new SaveEntryRequest { User = message.User, Text = message.Text, }); await _sender.SendAsync(new InfoEntryBroadcast { Id = saveResponse.Id, User = message.User, Text = message.Text, }); return(new PostEntryResponse { Id = saveResponse.Id, User = message.User, Text = message.Text, }); }
public static async Task SendAsync(this IRoutingSender sender, object request, CancellationToken cancellationToken = default) { var message = JsonMessage.Write(request); await sender.SendAsync(message, cancellationToken); }
public Task SendAsync(Message message, CancellationToken cancellationToken = default) { return(_policy.ExecuteAsync((_, policyToken) => _sender.SendAsync(message, policyToken), new Context(), cancellationToken)); }