Github user Bilna commented on a diff in the pull request:
https://github.com/apache/spark/pull/4270#discussion_r23831606
--- 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 --
Please try this also.
Along with waitForReceiverToStart(), change the 'for loop' range from 0 to
9 . It is just for testing.
I am getting this error only if I change the MqttDefaultFilePersistence to
memoryPersistence. I solved the problem by applying the proposed solution above.
---
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]