[rabbitmq-discuss] SimpleRpcServer send generated queue name to client

Robert Raschke rtrlists at googlemail.com
Wed Feb 17 14:15:10 GMT 2010


On Wed, Feb 17, 2010 at 2:02 PM, glenner <glenn.ergeerts at artesis.be> wrote:

>
> I have one server application and multiple client applications. The server
> can publish different kind of events to the interested clients. Clients
> express their interest in a certain event type (together with a predicate
> which describes in which situation they should get an event, so they can
> filter events). From that moment on the server pushes events to the
> subscribed clients when they occur and match the predicates.
>
> For implementing this i thought to have the server listening (using
> SimpleRpcServer) to one central queue where the subscription requests get
> send to. A new queue matching that subscription is then constructed by the
> server. The server publishes messages on the correct queues when certain
> events occur. The clients listen on their specific queue(s) (also using a
> SimpleRpcServer). The client knows which queue to listen to based on a
> convention (name of the event etc).
>
> Now the question: i want to be able to let the server specify (generate) a
> unique queue name for each client/event subscription and then send it back
> to the client so the client knows which queue to subscribe to. Is something
> like this possible? I could not find any support for replying inside the
> SimpleRpcServer.
>
> And, more general, is this a valid design using RabbitMQ/AMQP? I'm still
> new
> to RabbitMQ/AMQP so maybe i overlooked a more approriate way to do this..
>

The Erlang amqp client lib has an example RPC server.

In essence, when your client fires the "new subscription please" request it
also has to create a reply queue. The initial message from client to server
has to contain your "subscription request" plus your reply_to queue name
and, ideally, a correlation_id. The reply_to and correlation_id fields, I
think, are already part of the AMPQ message properties.

Your client can then receive the desired "new subscription" queue name as a
message from the server on the reply_to queue with the appropriate
correlation_id.

Hope this gets you into the right direction,
Robby
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20100217/2501a38d/attachment.htm 


More information about the rabbitmq-discuss mailing list