Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- val myStream = KafkaUtils.createDirectStream[K, V](
- streamingContext,
- PreferConsistent,
- Subscribe[K, V](topics, consumerConfig)
- )
- val myMap: Map[ObjA, ObjB] = getMyMap() // This is the variable I want to access in 'process'
- def process(record: (RDD[ConsumerRecord[String, String]], Time)): Unit = record match {
- // Code that uses myMap.get("key")
- }
- myStream.foreachRDD((x, y) => process((x, y)))
Add Comment
Please, Sign In to add comment