public async Task ExecuteAsync() { for (int i = 0; i < settings.Value.ElementsToProduce; i++) { var message = new AgnosticMessage <string> { Key = $"msg-{i}", Payload = $"msg-{i}-content" }; await producer.ProduceAsync("text", message); logger.LogInformation($"String sent: {message.Payload}"); } }
public async Task ExecuteAsync() { foreach (var filePath in fileClient.GetFiles(settings.Value.InputDirectory)) { var message = new AgnosticMessage <byte[]> { Key = filePath.Split('/').Last(), Payload = fileClient.Read(filePath) }; await producer.ProduceAsync("binary", message); logger.LogInformation($"Binary file read and sent: {message.Key}"); } }
public async Task ExecuteAsync() { for (int i = 0; i < settings.Value.ElementsToProduce; i++) { var domainObject = new SampleComplexObject(i); var message = new AgnosticMessage <string> { Key = domainObject.Id.ToString(), Payload = JsonConvert.SerializeObject(domainObject) //TODO: change serialization method }; await producer.ProduceAsync("json", message); logger.LogInformation($"JSON object sent: {domainObject.GetFullDescription()}"); } }