com.hivemq.client.mqtt.exceptions.MqttEncodeException

Received this error when I try to subscribe to 1 million topics using client.subscribeWith(). Any way to configure this maximum packet size? I feel this size is different from the message payload size.

java.util.concurrent.ExecutionException: com.hivemq.client.mqtt.exceptions.MqttEncodeException: SUBSCRIBE exceeded maximum packet size, minimal possible encoded length: 3189010, maximum: 1048576.
	at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:395) ~[?:?]
	at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2005) ~[?:?]
	at com.amazon.iot.bifrost.propertystate.mqtthub.impl.MqttSubscriberImpl.subscribeImpl(MqttSubscriberImpl.java:193) ~[IotSiteWiseEdgeProcessorApplication-1.0-super.jar:?]
	at com.amazon.iot.bifrost.propertystate.mqtthub.impl.MqttSubscriberImpl.lambda$null$0(MqttSubscriberImpl.java:65) ~[IotSiteWiseEdgeProcessorApplication-1.0-super.jar:?]
	at com.github.rholder.retry.AttemptTimeLimiters$NoAttemptTimeLimit.call(AttemptTimeLimiters.java:79) ~[IotSiteWiseEdgeProcessorApplication-1.0-super.jar:?]
	at com.github.rholder.retry.Retryer.call(Retryer.java:160) ~[IotSiteWiseEdgeProcessorApplication-1.0-super.jar:?]
	at com.amazon.iot.bifrost.propertystate.mqtthub.impl.MqttSubscriberImpl.lambda$subscribe$1(MqttSubscriberImpl.java:65) ~[IotSiteWiseEdgeProcessorApplication-1.0-super.jar:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
	at java.lang.Thread.run(Thread.java:829) [?:?]

Hi @DD_L,

The maximum packet size is determined by the MQTT broker settings. Which MQTT broker are you using? If it’s HiveMQ4, you can find information in their documentation here: https://docs.hivemq.com/hivemq/latest/user-guide/configuration.html#max-packet

Best regards,
Dasha from HiveMQ Team