alanxz / rabbitmq-c

RabbitMQ C client
MIT License
1.77k stars 670 forks source link

Add rpc_server example #394

Open alanxz opened 7 years ago

wallkietallkie commented 7 years ago

Hello alanxz, well I've implemented rabbitmq-c , and work fine except for rpc-server. I need to create a type RPC from Java(Client RPM) to client in C(Server RPC), in this moment I implemented:

Java client basic_publish RPC ------> RabbitMQ --------> Rabbit-C Consume(amqp_listen.c)

I can read request from Java but I need return a response for the queue (amq.gen.XXXXXX) and
How do I do that ?

Thanks for the API.

alanxz commented 7 years ago

Once you've consumed a message and processed it, your code should publish to the default exchange (amqp_empty_bytes), with a routing key that is specified in the reply_to header in the request message. Additionally your code should set the correlation_id header to be the same as what is in the request message.

wallkietallkie commented 7 years ago

A lot of thanks Alanxz , my rpc-server implementation was successful:

https://github.com/alanxz/rabbitmq-c/compare/master...wallkietallkie:patch-1

Regards

rheerila commented 7 years ago

Hi alanxz, actually I do not see any rpc_server file on the example folder, only one rpc_sendstrings file,. Is that you remove the rpc_server example to the other place? Thanks~

alanxz commented 7 years ago

@rheerila there currently is no rpc_server example, this issue tracks adding this.

dhthong92 commented 6 years ago

@alanxz So that's mean the driver currently still not support create rpc_server right?

alanxz commented 6 years ago

@dhthong92 the library supports creation of a rpc-server, however there is no example provided describing how to do so.