daily pastebin goal
44%
SHARE
TWEET

Untitled

a guest Mar 20th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import org.apache.spark.SparkConf
  2. import org.apache.spark.streaming.{Seconds, StreamingContext}
  3. import org.apache.spark.eventhubs._
  4. import org.apache.spark.sql.types._
  5. import org.apache.spark.sql.functions._
  6. import org.apache.spark._
  7. object SparkStreaming_Event {
  8.   def main(args: Array[String]) {
  9.     val sparkConf = new SparkConf().setAppName("StreamEvents")
  10.     val ssc = new StreamingContext(sparkConf, Seconds(10))
  11.     val connectionString = ConnectionStringBuilder("Connectionstring").setEventHubName("Name").build
  12.     val ehConf = EventHubsConf(connectionString)
  13.       .setStartingPosition(EventPosition.fromEndOfStream)
  14.       .setMaxRatePerPartition(10000)
  15.     val stream = EventHubsUtils.createDirectStream(ssc, ehConf)
  16.     stream.print()
  17.     ssc.start()
  18.     ssc.awaitTermination()
  19.   }
  20. }
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