Github user zsxwing commented on a diff in the pull request:
https://github.com/apache/spark/pull/11176#discussion_r54139894
--- Diff:
external/akka/src/main/scala/org/apache/spark/streaming/akka/ActorReceiver.scala
---
@@ -105,13 +108,25 @@ abstract class ActorReceiver extends Actor {
}
/**
- * Store a single item of received data to Spark's memory.
+ * Store a single item of received data to Spark's memory asynchronously.
* These single items will be aggregated together into data blocks before
* being pushed into Spark's memory.
*/
def store[T](item: T) {
context.parent ! SingleItemData(item)
}
+
+ /**
+ * Store a single item of received data to Spark's memory synchronously.
+ * These single items will be aggregated together into data blocks before
+ * being pushed into Spark's memory.
+ *
+ * As opposed to [[ActorReceiver.store[T]: Unit]], this method allows
flow control
+ * (maxRate, backpressure) to block the input.
--- End diff --
not need to block actually. E.g., the user can write the following non
blocking codes to control the speed as well.
```
class UserActor extends ActorReceiver {
override def preStart(): Unit = {
self ! Emit
}
override def receive: Receive = {
case Emit =>
val item = getNextItem()
store(item, 10.seconds).onSuccess {
case _ =>
self ! Emit
}
}
}
```
So please change it to `this method allows the user to control the flow
speed using `Future`.`
---
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]