Created
September 1, 2016 20:23
-
-
Save philmadden83/b913dc4ee9253e1464d8bbac7fde758b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
@Service | |
public class ThreatDetectService { | |
private final ThreatService threatService | |
..constructor / injection | |
public void recordLoginEvent(String email, ... , Environment environment) { | |
recordEvent(new LoginEvent(email, ..., environment)); | |
} | |
public void recordXXXEvent(String xxx, ... , Environment environment) { | |
recordEvent(new XXXEvent(xxx, ..., environment)); | |
} | |
private static void recordEvent(Event e) { | |
try { | |
RecordResponse response = threatService.recordEvent(e); | |
if (!response.isSuccess() { | |
LOGGER.warn(String.format("Error recording ThreatService %s. Response: %s Message: %s.", event.getClass().getSimpleName(), response.getRequestId() , response.getMessage())); | |
} | |
} catch (ThreatRecordException e) { | |
LOGGER.error(e.getMessage(), e); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment