Github user harishreedharan commented on a diff in the pull request:
https://github.com/apache/spark/pull/6830#discussion_r32781527
--- Diff:
external/flume/src/main/scala/org/apache/spark/streaming/flume/FlumeUtils.scala
---
@@ -236,3 +242,71 @@ object FlumeUtils {
createPollingStream(jssc.ssc, addresses, storageLevel, maxBatchSize,
parallelism)
}
}
+
+/**
+ * This is a helper class that wraps the methods in FlumeUtils into more
Python-friendly class and
+ * function so that it can be easily instantiated and called from Python's
FlumeUtils.
+ */
+private class FlumeUtilsPythonHelper {
+
+ def createStream(
+ jssc: JavaStreamingContext,
+ hostname: String,
+ port: Int,
+ storageLevel: StorageLevel,
+ enableDecompression: Boolean
+ ): JavaPairDStream[Array[Byte], Array[Byte]] = {
+ val dstream = FlumeUtils.createStream(jssc, hostname, port,
storageLevel, enableDecompression)
+ FlumeUtilsPythonHelper.toDStreamForPython(dstream)
+ }
+
+ def createPollingStream(
+ jssc: JavaStreamingContext,
+ hosts: JList[String],
+ ports: JList[Int],
--- End diff --
hmm, ok. I generally don't like APIs that have two lists that have index
based matching. Perhaps we can pass in a `Map`?
Since is not really user-facing, I am sort-of-ok with this, but I'd prefer
to have a cleaner API.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]