try {
// just the basics to construct NB messages
// we may add more info as needed in the MessageService
// but avoid lookups here for now since soon this will just be a queue and not send messages.
Event event = new Event();
// TODO: This should be rewritten to use EventService#createEvent(...) and to have a real EventId
if (!account.equals("global")) {
event.setAccountId(new ObjectId(account));
}
event.setEventId(EventId.valueOf((String) eventMap.get("type")));
//If this came from AMQ it may be be a serialized ObjectId, or if it
//came from elsewhere it's a string representation of ObjectId. Instantiate
//a new ObjectId just in case.
event.setTargetId(new ObjectId(eventMap.get("targetId").toString()));
event.setMetadata(eventMap);
messageService.sendNodebellyInsightMessage(event, (Long) eventMap.get("timestamp"), null);
} catch (Exception e) {
logger.error("Failed to send a NodebellyInsightMessage: " + e.getMessage(), e);
}