public async Task PublishAsync(string topicName, string servicePath) { var gateRequest = await HttpContext.Request.ToGateRequestAsync(servicePath); await _gatePublisher.PublishAsync(topicName, gateRequest, HttpContext.RequestAborted); HttpContext.Response.StatusCode = StatusCodes.Status202Accepted; }
public static async Task PublishAsync <T>(this IGatePublisher gatePublisher, string topicName, T gateMessage, CancellationToken cancellationToken) { topicName = topicName ?? throw new ArgumentNullException(nameof(topicName)); var message = Serializer.Serialize(gateMessage); await gatePublisher.PublishAsync(topicName, message, cancellationToken); }