In the .NET version (2.4.1) of RabbitMQ the RabbitMQ.Client.MessagePatterns.SimpleRpcClient has a Call() method with these signatures:
public virtual object[] Call(params object[] args);
public virtual byte[] Call(byte[] body);
public virtual byte[] Call(IBasicProperties requestProperties, byte[] body, out IBasicProperties replyProperties);
The problem:
With various attempts, the method still continues to not block where I expect it to, so it’s unable ever handle the response.
The Question:
Am I missing something obvious in the setup of the SimpleRpcClient, or earlier with the IModel, IConnection, or even PublicationAddress?
More Info:
I’ve also tried various paramater configurations of the QueueDeclare() method too with no luck.
string QueueDeclare(string queue, bool durable, bool exclusive, bool autoDelete, IDictionary arguments);
Some more reference code of my setup of these:
IConnection conn = new ConnectionFactory{Address = "127.0.0.1"}.CreateConnection());
using (IModel ch = conn.CreateModel())
{
var client = new SimpleRpcClient(ch, queueName);
var queueName = ch.QueueDeclare("t.qid", true, true, true, null);
ch.QueueBind(queueName, "exch", "", null);
//HERE: does not block?
var replyMessageBytes = client.Call(prop, msgToSend, out replyProp);
}
Looking elsewhere:
Or is it likely there’s an issue in my “server side” code? With and without the use of BasicAck() it appears the client has already continued execution.
–SHORT ANSWER–
Bit of the “You’re doing it wrong“…
If you stumble upon this question, you’ve either taken the wrong approach as I have, and possibly if made a similar mistake of manipulating IBasicProperties incorectly thereby hurting the ability of SimpleRpcServer to function correctly.
–LONG ANSWER–
Working Sample for .NET:
Find my working example up on BitBucket here:
Or here’s a quick sample…
Client side:
Server side:
Shared: