I've defined the following Duct:
val augmenter1 = new Augmenter1
val augmenter2 = new Augmenter2
val augmenter3 = new Augmenter3
val defaultEventAugmenterPipeline: Duct[Event, Event] = Duct[Event].
map(augmenter1.augment).
map(augmenter2.augment).
map(augmenter3.augment)
and Flow:
Flow(eventConsumer).append(defaultEventAugmenterPipeline).onComplete(materializer) { ... }
and an Augmenter looks like this:
class Augmenter1 extends Augmenter[Event] {
def augment(e: Event): Event = {
if(someCondition)
e.addAugmentation(...)
else
throw new Exception("someCondition not met!")
e
}
}
Now, if the condition that leads to the exception in Augmenter1 is met, the flow simply terminates (successfully) at the first instance of the exception, without throwing any exception. I'd like to be able to do 2 things: catch the exception up the chain, and skip to the next event.
My question: what is the proper way to deal with errors/exceptions in a flow ?
Thanks