public static void main ( String [ ] args ) throws Exception { SparkStreamingBinding binding = null ; try { binding = SparkStreamingBindingFactory . build ( BootstrapCluster . getProperties ( ) ) ; binding . init ( ) ; BootstrapCluster . createTransformers ( binding . getStreamingContext ( ) . sparkContext ( ) , binding . getSparkSession ( ) ) ; binding . startContext ( ) ; binding . awaitTermination ( ) ; } catch ( Throwable error ) { String msg = "Error trying to invoke BootstrapClusterStreaming.main: " + error ; System . err . println ( new Date ( ) + ": " + msg ) ; error . printStackTrace ( System . err ) ; // required as in local mode the following seems to be lost LOG . error ( msg , error ) ; throw new IllegalStateException ( msg , error ) ; } finally { try { if ( binding != null ) { binding . close ( ) ; } } catch ( Exception ex ) { LOG . warn ( "Error on binding close: " + ex , ex ) ; } } }
Bootstrapping the Driver which starts a Spark job on cluster