public static InetSocketAddress getHostPortPair ( Service svc ) { try { return new InetSocketAddress ( svc . getMetadata ( ) . get ( "service.host" ) , Integer . parseInt ( svc . getMetadata ( ) . get ( "service.port" ) ) ) ; } catch ( Exception e ) { logger . error ( "Exception extracting metadata from service instance {}" , svc , e ) ; return null ; } }
Safely get the information from our convention