Пример #1
0
        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;
        }
Пример #2
0
        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);
        }