private static async Task AddStockProxy(string productName, int quantity) { var message = new ProductStockEvent() { Action = StockAction.Add, ProductName = productName, Quantity = quantity }; var stringTask = await client.PostAsJsonAsync("https://localhost:44371/api/Inventory", message); }
public async Task Post([FromBody] ProductStockEvent value) { var config = new ProducerConfig { BootstrapServers = "127.0.0.1:9092" }; using (var producer = new Producer <string, string>(config)) { var deliveryReport = await producer.ProduceAsync(TOPICS.INVENTORYEVENTS, new Message <string, string> { Key = value.ProductName, Value = JsonConvert.SerializeObject(value) }); } }