[rabbitmq-discuss] Poker service architecture using RabbitMQ

Michael Klishin mklishin at gopivotal.com
Tue Jan 21 07:54:13 GMT 2014


On 21 Jan 2014, at 11:38, Cary Cherng <ccherng at gmail.com> wrote:

> Suppore there are many servers and each handles a bunch of poker
> games. But how does the routing state get setup with RabbitMQ?

By applications, see [1].

> 
> To be concrete consider two players A and B where A challenges B to a
> heads up poker game. The game is created on one of the servers. This
> create game message is sent to some server through a load balancing
> choice made with RabbitMQ somehow? Also later when A sends an action
> like raising how does this get routed to the right server and how does
> that server then know how to route a message to B?

One obvious way would be to create a queue per connected player
(it is possible to create a queue that will be deleted when client closes
its connection), with incoming events having type specified (e.g. lobby.challenges.received
or game.rounds.raise).

Messages sent from player A to B can carry sender queue’s name which can be used
by B to send a reply. See Tutorial 6 [2].

> And suppose B disconnects and then reconnects. How does B figure out
> what queue to subscribe to be able to communicate with the server
> running the game so that B can acquire the latest state?

Queues can have well-known names, e.g. players.{username}.

1. http://www.rabbitmq.com/tutorials/amqp-concepts.html
2. http://www.rabbitmq.com/getstarted.html

MK

Software Engineer, Pivotal/RabbitMQ




More information about the rabbitmq-discuss mailing list