Created
May 24, 2018 14:21
-
-
Save mykidong/e0823e9bca72de68622508425552a158 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
this.putDisruptor = DisruptorCreator.singleton(DisruptorCreator.DISRUPTOR_NAME_PUT, EventLog.FACTORY, 1024, produceToKafkaHandler, loggerEventHandler); | |
this.putEventTranslator = new BaseTranslator.EventLogTranslator(); | |
... | |
@Override | |
public void onEvent(final EventLog eventLog, final long sequence, final boolean endOfBatch) throws Exception { | |
String version = eventLog.getVersion(); | |
String json = eventLog.getValue(); | |
// Validation | |
if (eventLogValidationEnabled) { | |
try { | |
// if the event is invalid, just return. | |
if (!evenValidator.isValid(version, json)) { | |
return; | |
} | |
}catch (Exception e) | |
{ | |
e.printStackTrace(); | |
log.error(e.getMessage()); | |
return ; | |
} | |
} | |
this.putEventTranslator.setVersion(version); | |
this.putEventTranslator.setEventType(eventLog.getEventType()); | |
this.putEventTranslator.setValue(json); | |
this.putDisruptor.publishEvent(this.putEventTranslator); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
.