为服务器动态验证的用户标识重载 artemis 中的资源限制设置

Overload resource-limit-setting in artemis for a user-id validated dynamically by the server

我不想将用户信息存储在 artemis 服务器中,因为我的身份验证将基于 KDF。因此,用户将根据来自客户端的一些密钥进行动态验证。验证后,我想根据某个角色为用户设置 max-connectionsmax-queues

broker.xml:

<resource-limit-settings>
   <resource-limit-setting match="myUser">
      <max-connections>5</max-connections>
      <max-queues>3</max-queues>
   </resource-limit-setting>
</resource-limit-settings>

如何在运行时传递 UserId("myUser") 以便为每个经过身份验证的用户设置资源限制设置?

来自Artemis documentation

Unlike the match from address-setting, this match does not use any wild-card syntax. It's a simple 1:1 mapping of the limits to a user.

您引用的文档对此进行了总结。您不能根据角色设置限制。您只能根据用户设置限制。您希望为其设置限制的每个用户都必须在 broker.xml 中枚举。与其他设置(例如 address-settingssecurity-settings 等)不同,资源限制没有管理 API,因此它们在运行时不能 added/removed/changed。

当然,这里的功能还可以加强。 ActiveMQ Artemis 是一个开源的 Apache 项目,我们随时欢迎您的贡献。