Guest User

Untitled

a guest
Apr 17th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  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)))
Add Comment
Please, Sign In to add comment