MQTT报文超过最大消息,消息大小长度

项目中接触到mqtt用的是emqtt,下发消息的时候消息数量过大,就会提示

已断开连接 (32109) - java.io.EOFException
	at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:181)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)
	at java.util.concurrent.FutureTask.run(FutureTask.java)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.EOFException
	at java.io.DataInputStream.readByte(DataInputStream.java:267)
	at org.eclipse.paho.client.mqttv3.internal.wire.MqttInputStream.readMqttWireMessage(MqttInputStream.java:92)
	at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:133)
	... 8 more

我测试过无数次,证明不是连接断开的原因,只要发送的数据小于60kb左右就没事,在数据库中一点点长度测出来的

MQTT报文超过最大消息,消息大小长度

但是这个也解决不了我的问题啊.我需要下发130KB左右的消息,里面包含了base64图片问题

在官网找文档

https://docs.emqx.io/broker/v3/cn/config.html#mqtt

MQTT 最大报文尺寸:

mqtt.max_packet_size = 1MB

随后去 \emqttd\etc\emq.conf果然找到了这个大小

## Maximum MQTT packet size allowed.
##
## Value: Bytes
##
## Default: 64K
mqtt.max_packet_size = 64KB

人家实际限制的是64KB,将这个数值改一下重启

MQTT报文超过最大消息,消息大小长度

这下好了.在此记录一下 

上一篇:linux – 从grub rescue命令提示符启动窗口


下一篇:LockSupport工具类详解