开发者

Dynamic ACLs in RabbitMQ

开发者 https://www.devze.com 2023-03-06 00:32 出处:网络
I\'m considering RabbitMQ\'s usefulness for creating a multi-user chat system. People would be able to chat in various rooms, some public and some private, and privately person-to-person. Would it be

I'm considering RabbitMQ's usefulness for creating a multi-user chat system. People would be able to chat in various rooms, some public and some private, and privately person-to-person. Would it be possible to implement the functionality of private, invite-only rooms? For person-to-person, I might be able to use random strings for the queue/exchange names, but that wouldn't work for private rooms where the capability needs to be revokable.

Is the functionality of rab开发者_高级运维bitmqctl available to (selected) clients, and how scalable are the ACLs? Can an ACL reference the username, for a rule matching "<user>.*"?


I think I have the start of a workable solution to this. I'll create a public exchange to which any user can send a room join request. The 'server' software (actually just another RabbitMQ client) consumes from this queue, and if the user is allowed to join then it binds the room's outgoing message fanout exchange to the user's queue. Users will get an ACL including something like ^public/.*, so they would only be able to publish to the public exchange.


You can configure ACLs on RabbitMQ at the user level and the individual resources (queues or exchanges using regex) - but I don't believe this functionality is exposed through most clients.

If you are looking to build a chat client you would be much better off using ejabberd (http://www.ejabberd.im/) which is built for exactly this kind of scenario:

Multi-User Chat with eJjabberd

0

精彩评论

暂无评论...
验证码 换一张
取 消