Skip to content

Instantly share code, notes, and snippets.

@NajeebArif
Created May 16, 2022 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NajeebArif/1dc356c5781a2b53a20eae7ef858cb41 to your computer and use it in GitHub Desktop.
Save NajeebArif/1dc356c5781a2b53a20eae7ef858cb41 to your computer and use it in GitHub Desktop.
private KeyValue<String, Tuple<Throwable, OrderInputMsg>> getTransformedMessage(String key, OrderInputMsg value) {
try{
final OrderInputMsg msg = OrderProcessorService.processOrderMsg(value);
final Tuple<Throwable, OrderInputMsg> inputMsgTuple = new Tuple<>(null, msg);
return new KeyValue<>(key, inputMsgTuple);
}catch (Exception e){
final Tuple<Throwable, OrderInputMsg> inputMsgTuple = new Tuple<>(e, value);
return new KeyValue<>(key, inputMsgTuple);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment