How is the use of publish in the Publish_Specs class in the MassTransit.KafkaIntegration.Tests project? We noticed that the publish method does not send to the topic as you say , how does the consumer read it message? Can we understand the logic? thanks
class KafkaMessageConsumer :
IConsumer<KafkaMessage>
{
readonly IPublishEndpoint _publishEndpoint;
readonly TaskCompletionSource<ConsumeContext<KafkaMessage>> _taskCompletionSource;
public KafkaMessageConsumer(IPublishEndpoint publishEndpoint, TaskCompletionSource<ConsumeContext<KafkaMessage>> taskCompletionSource)
{
_publishEndpoint = publishEndpoint;
_taskCompletionSource = taskCompletionSource;
}
public async Task Consume(ConsumeContext<KafkaMessage> context)
{
_taskCompletionSource.TrySetResult(context);
await _publishEndpoint.Publish<BusPing>(new { });
}
}