How to get SimpleRpcClient.Call() to be a blocking call to achieve synchronous communication with RabbitMQ?
Posted
by
Nick Josevski
on Stack Overflow
See other posts from Stack Overflow
or by Nick Josevski
Published on 2011-05-10T07:54:56Z
Indexed on
2012/03/26
11:30 UTC
Read the original article
Hit count: 263
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.
© Stack Overflow or respective owner