Skip to content

Instantly share code, notes, and snippets.

@p14n
Last active December 11, 2015 22:58
Show Gist options
  • Save p14n/4673436 to your computer and use it in GitHub Desktop.
Save p14n/4673436 to your computer and use it in GitHub Desktop.
public class RemoteErrorActor extends UntypedActor {
@SuppressWarnings("rawtypes")
@Override
public void onReceive(Object o) throws Exception {
if (o instanceof RemoteClientWriteFailed) {
RemoteClientWriteFailed fail = (RemoteClientWriteFailed) o;
if (fail.getRequest() instanceof Tuple3) {
Tuple3 t3 = (Tuple3) fail.getRequest();
if (t3._2() instanceof Some) {
Some s = (Some) t3._2();
if (s.get() instanceof PromiseActorRef) {
PromiseActorRef par = (PromiseActorRef) s.get();
par.tell(/*something useful*/, self());
}
}
}
}
}
}
system.eventStream().subscribe(system.actorOf(new Props(RemoteErrorActor.class)),
RemoteClientWriteFailed.class);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment