using Cloud.Services.Broker.Support; namespace Cloud.Services.Broker.Implement.Kafka { public class KafkaService : IBrokerService { private readonly KafkaProducer _producer; private readonly KafkaConsumer _consumer; public KafkaService(IConfiguration configuration) { _producer = new KafkaProducer(configuration); _consumer = new KafkaConsumer(configuration); } public T? Consume(string topic) where T : IBrokerResponse => _consumer.WaitMessage(topic); public async Task Produce(Command command) => await _producer.ProduceAsync("commands", command); } }