Esempio n. 1
0
        public async Task ProduceAsync(IMessage <TKey, TValue> message, CancellationToken cancellationToken = default)
        {
            if (string.IsNullOrEmpty(message.ChannelName))
            {
                message.ChannelName = _channelWriter.Name;
            }

            var messageBytes = await _messageAdapter.AdaptAsync(message).ConfigureAwait(false);

            await _channelWriter.WriteAsync(messageBytes, cancellationToken).ConfigureAwait(false);

            MessageSent?.Invoke(message);
        }
Esempio n. 2
0
 public ValueTask WriteAsync(byte[] messageBytes, CancellationToken cancellationToken = default) =>
 _outputChannel.WriteAsync(messageBytes, cancellationToken);