private bool sendMessages(List <CompensationInvestment> compList, string topicName) { foreach (CompensationInvestment comp in compList) { var jComp = comp.GenerateJson(); try { _kafkaPublisher.SendMessage(jComp, topicName, comp.fileKey); } catch (Exception e) { _logger.LogError("MessagePublisher:sendMessage : Error while sending message to topic :{0}. Details :{1}", topicName, e); } } return(true); }
private bool sendMessage(string investment) { try { Guid fileKey = getFileKey(investment); string topicName = _kafkaConfigHelper.ParticipantAllocationsTopicName; _kafkaPublisher.SendMessage(investment, topicName, fileKey); _logger.LogTrace("message sent to Kafka topicName={0}, fileKey={1}, payload={2}", topicName, fileKey, investment); return(true); } catch (Exception e) { //TODO: WHAT DO WE DO WHEN AN ERROR POSTING TO KAFKA? _logger.LogError(e, e.Message); } return(false); }
public bool EnrichAndSendMessage(string key, Guid fileGuid, int fileAllocationCount, string topicName) { try { int processedAllocationCount = _allocationRepo.Count(x => x.Key == key); //When allocation for a file is complete send message if ((fileAllocationCount > 0 && processedAllocationCount >= fileAllocationCount)) { _publisher.SendMessage(getEnrichedMessage(key).ToString(), topicName, fileGuid); return(true); } } catch (Exception ex) { _logger.LogCritical("AggregationManager : EnrichAndSendMessage error while sending message", ex); } return(false); }