在 ActiveMQ Artemis 中限制消息的大小
Restrict the size of message in ActiveMQ Artemis
对于尝试在 artemis 主题中发布 mqtt 消息的用户,我想将消息大小限制为 800 KB,为此我在 theetc/broker.xml 中更新了地址设置
<max-size-bytes>800</max-size-bytes>
<page-size-bytes>800</page-size-bytes>
这似乎不起作用,我可以通过 MQTT 客户端发布 1 MB 的消息。
max-size-bytes
设置适用于 地址,而不是邮件。此外,这个没有符号的设置被解释为字节(尽管可以使用其他字节符号,例如 MB
、kb
等)。因此,设置 <max-size-bytes>800</max-size-bytes>
将告诉代理在匹配地址中的总字节数为 800
时强制执行相应的 address-full-policy
(默认情况下为 PAGE
)。正如 the documentation 所述,max-size-bytes
是:
...the max memory the address could have before entering on page mode.
这里支持几种不同的policies/modes。除了 PAGE
之外,经纪人还支持 FAIL
、DROP
和 BLOCK
。有关这些的更多详细信息,请参阅 the documentation。
如果您想严格根据邮件的大小排除邮件,我建议您实施 MQTT interceptor. Ensure you're using at least 2.12.0 so that you have the fix for this issue。
对于尝试在 artemis 主题中发布 mqtt 消息的用户,我想将消息大小限制为 800 KB,为此我在 theetc/broker.xml 中更新了地址设置
<max-size-bytes>800</max-size-bytes>
<page-size-bytes>800</page-size-bytes>
这似乎不起作用,我可以通过 MQTT 客户端发布 1 MB 的消息。
max-size-bytes
设置适用于 地址,而不是邮件。此外,这个没有符号的设置被解释为字节(尽管可以使用其他字节符号,例如 MB
、kb
等)。因此,设置 <max-size-bytes>800</max-size-bytes>
将告诉代理在匹配地址中的总字节数为 800
时强制执行相应的 address-full-policy
(默认情况下为 PAGE
)。正如 the documentation 所述,max-size-bytes
是:
...the max memory the address could have before entering on page mode.
这里支持几种不同的policies/modes。除了 PAGE
之外,经纪人还支持 FAIL
、DROP
和 BLOCK
。有关这些的更多详细信息,请参阅 the documentation。
如果您想严格根据邮件的大小排除邮件,我建议您实施 MQTT interceptor. Ensure you're using at least 2.12.0 so that you have the fix for this issue。