Ejemplo n.º 1
0
        private async Task PublishAsyncCore <TM>(TM message, CancellationToken cancellationToken)
            where TM : IMessage
        {
            var writer = _channelFactory.GetWriter <TM>();

            if (writer is not null)
            {
                await writer.WriteAsync(message, cancellationToken)
                .ConfigureAwait(false);
            }
        }
Ejemplo n.º 2
0
        private async Task PublishAsyncCore <TM>(TM message, CancellationToken cancellationToken)
            where TM : IMessage
        {
            var writer = _channelFactory.GetWriter <TM>();

            if (writer is not null)
            {
                _logger.LogInformation($"publishing message '{message.Id}'...");
                await writer.WriteAsync(message, cancellationToken)
                .ConfigureAwait(false);
            }
            else
            {
                _logger.LogWarning($"no suitable publisher found for message '{message.Id}' with type '{typeof(TM).FullName}' !");
            }
        }