Skip to content

Instantly share code, notes, and snippets.

@zregvart
Created May 22, 2017 09:07
Show Gist options
  • Save zregvart/149491613f3d3f009b80f6e75c9d2df5 to your computer and use it in GitHub Desktop.
Save zregvart/149491613f3d3f009b80f6e75c9d2df5 to your computer and use it in GitHub Desktop.
class ExampleProcessor implements Processor {
@Override
public void process(Exchange exchange) throws Exception {
try {
// do your transformation here
} catch (ExampleException e) {
final List<ExampleException> allExceptions = Optional
.ofNullable(exchange.getProperty("all-exceptions", List.class)).orElseGet(ArrayList::new);
allExceptions.add(e);
exchange.setProperty("all-exceptions", allExceptions);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment