Skip to content

Instantly share code, notes, and snippets.

@mykidong
Created May 24, 2018 14:21
Show Gist options
  • Save mykidong/e0823e9bca72de68622508425552a158 to your computer and use it in GitHub Desktop.
Save mykidong/e0823e9bca72de68622508425552a158 to your computer and use it in GitHub Desktop.
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);
}
@mykidong
Copy link
Author

.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment