[rabbitmq-discuss] Client connect/disconnect events on the server side
matthias at rabbitmq.com
Tue Mar 15 19:02:33 GMT 2011
On 15/03/11 04:31, Deepak Vijayvergiy wrote:
> Hi Miguel,
> Even I have the same scenario, and I have my clients
> announcing(publishing) their connect and disconnect at the time of
> log-in and log-off resp. I have a deamon process running which is a pure
> consumer listening on 'register.*'.
> Would be interested to know if some better way exists.
'presence' is a highly application dependent concept. Support for it in
the messaging system itself could only accommodate a very restricted set
of use cases. So it's best handled by applications.
One fairly generic and flexible way is to get clients to publish a
presence message every so often to some dedicated exchange. That message
can contain all kinds of application specific information, e.g. to
identify the user, what their status is, etc. An app can then consume
these messages, update some db with status information, send status
change messages to clients interested and authorised to see them (e.g.
'friends'). The app can also detect the absence of the messages and mark
the user as absent.
In this scheme
- the notion of presence is not tied to the lifetime of connections, or
queues, or bindings
- the notion of users (or, more generally, 'the things of which we want
to know the presence') is not tied to that of AMQP users
- presence can be more than just a flag, i.e. all kinds of complex
status information can be transmitted
More information about the rabbitmq-discuss