79157921

Date: 2024-11-05 06:51:05
Score: 3
Natty:
Report link

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 { });
     }
 }
Reasons:
  • Blacklisted phrase (0.5): thanks
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Starts with a question (0.5): How is the use of
  • Low reputation (1):
Posted by: guncer