Github user dragos commented on a diff in the pull request:
https://github.com/apache/spark/pull/4270#discussion_r23828743
--- Diff:
external/mqtt/src/test/scala/org/apache/spark/streaming/mqtt/MQTTStreamSuite.scala
---
@@ -121,8 +130,18 @@ class MQTTStreamSuite extends FunSuite with Eventually
with BeforeAndAfter {
val message: MqttMessage = new MqttMessage(data.getBytes("utf-8"))
message.setQos(1)
message.setRetained(true)
+
+ def tryPublish(times: Int): Unit =
+ if (times > 0) try {
+ msgTopic.publish(message)
+ } catch {
+ case e: MqttException if e.getReasonCode ==
MqttException.REASON_CODE_MAX_INFLIGHT =>
+ Thread.sleep(50) // wait for Spark streaming to consume
something from the message queue
+ tryPublish(times - 1)
+ }
+
for (i <- 0 to 100) {
- msgTopic.publish(message)
+ tryPublish(3)
--- End diff --
I can do that, but it won't retry the same message, instead if would just
ignore a failure. In that case the total number of messages will be less than
101.
---
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]