Last active
May 7, 2017 17:49
-
-
Save garystafford/ba8d37eb4b9270beb4a376d547b7df30 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public List<CandidateVoterView> getCandidatesMessageRpc(String election) { | |
logger.debug("Sending RPC request message for list of candidates..."); | |
String requestMessage = election; | |
String candidates = (String) rabbitTemplate.convertSendAndReceive( | |
directExchange.getName(), "rpc", requestMessage); | |
TypeReference<Map<String, List<CandidateVoterView>>> mapType = | |
new TypeReference<Map<String, List<CandidateVoterView>>>() {}; | |
ObjectMapper objectMapper = new ObjectMapper(); | |
Map<String, List<CandidateVoterView>> candidatesMap = null; | |
try { | |
candidatesMap = objectMapper.readValue(candidates, mapType); | |
} catch (IOException e) { | |
logger.info(String.valueOf(e)); | |
} | |
List<CandidateVoterView> candidatesList = candidatesMap.get("candidates"); | |
logger.debug("List of {} candidates received...", candidatesList.size()); | |
return candidatesList; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment