daily pastebin goal
75%
SHARE
TWEET

Untitled

a guest Apr 17th, 2018 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. val myStream = KafkaUtils.createDirectStream[K, V](
  2.       streamingContext,
  3.       PreferConsistent,
  4.       Subscribe[K, V](topics, consumerConfig)
  5.     )
  6.  
  7.   val myMap: Map[ObjA, ObjB] = getMyMap() // This is the variable I want to access in 'process'
  8.  
  9.   def process(record: (RDD[ConsumerRecord[String, String]], Time)): Unit = record match {
  10.  
  11.      // Code that uses myMap.get("key")
  12.  
  13.   }
  14.  
  15.   myStream.foreachRDD((x, y) => process((x, y)))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top