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); }
public ValueTask WriteAsync(byte[] messageBytes, CancellationToken cancellationToken = default) => _outputChannel.WriteAsync(messageBytes, cancellationToken);