[rabbitmq-discuss] RabbitMQ Synchronous Client Example?

Lynton Grice lynton.grice at logosworld.com
Sun Jul 19 15:27:22 BST 2009


Hi Ben,

Yup, I ran that earlier and it worked fine....thanks....

Can you explain to me how it would work if I had a PYTHON consumer (or
other) that would take the message off the queue....process it and send it
back? What do I send it back to?  I assume it would all be on
"correlationid".....

I can see the TEST code below:

rpc_test(Connection) ->
    Q = uuid(),
    Fun = fun(X) -> X + 1 end,
    RPCHandler = fun(X) -> term_to_binary(Fun(binary_to_term(X))) end,
    Server = amqp_rpc_server:start(Connection, Q, RPCHandler),
    Client = amqp_rpc_client:start(Connection, Q),
    Input = 1,
    Reply = amqp_rpc_client:call(Client, term_to_binary(Input)),
    Expected = Fun(Input),
    DecodedReply = binary_to_term(Reply),
    ?assertMatch(Expected, DecodedReply),
    amqp_rpc_client:stop(Client),
    amqp_rpc_server:stop(Server),
    ok.

So as I mentioned above I want to send the message to a Python consumer, let
it process the message and send the response back....

Any ideas? Or a rough sketch on how that would work?

Thanks for the help, I really appreciate it ;-)

Lynton



 
-----Original Message-----
From: Ben Hood [mailto:0x6e6562 at gmail.com] 
Sent: 19 July 2009 03:54 PM
To: Lynton Grice
Cc: rabbitmq
Subject: Re: [rabbitmq-discuss] RabbitMQ Synchronous Client Example?

Lynton,

On Sun, Jul 19, 2009 at 8:59 AM, Lynton
Grice<lynton.grice at logosworld.com> wrote:

> Ideally I would want an AMQP client in Erlang code for the RPC
pattern....I
> will check it out, thanks for the help ;-)

Not really sure if I understand you correctly but there is an RPC over
AMQP pattern in the Erlang client.

Check out the test case for it to see it's usage (the test is called
rpc_test/1 in the test_util module).

HTH,

Ben





More information about the rabbitmq-discuss mailing list