RouteUnavailableMessage routeUnavailableMessage = (RouteUnavailableMessage) message;
LOGGER.debug("Received route unavailable. Message: {}", routeUnavailableMessage);
Route route = owner.removeRoute(routeUnavailableMessage.getId());
routes.remove(route);
} else if (message instanceof RoutableMessage) {
RoutableMessage routableMessage = (RoutableMessage) message;
peerGroup.send(routableMessage.getDestination(), message);
} else if (message instanceof EndOfStreamEvent) {
for (Route route : routes) {
LOGGER.debug("Removing route {} due to end of stream.", route.id);
owner.removeRoute(route.id);
}