Hey guys, I&#39;m new to RabbitMQ and am having trouble finding the answer to this question on Google, so please forgive me if this is old hat.<div><br></div><div>I&#39;m trying to setup a request/response queue with a TTL on the request messages. �My client is only going wait 500ms for a response. �If the client does not get a response in 500ms it&#39;s going to bail. �Because of this, there&#39;s no reason for the server to handle messages that have been in the queue for longer than 500ms.</div>
<div><br></div><div>I&#39;ve setup a simple test case using SimpleRpcClient and SimpleRpcServer. �Everything works except message expiration. �All requests sent to the queue are processed by the server code, regardless of how long they sat in the queue. �I could, of course, add a timestamp to my message and handle filter them manually, but I was hoping the RabbitMQ infrastructure could do this for me. �</div>
<div><br></div><div>Here&#39;s the client code (C#):</div><div><br></div><div><div>var connectionFactory = new ConnectionFactory();</div><div><br></div><div>using (var connection = connectionFactory.CreateConnection(&quot;127.0.0.1&quot;))</div>
<div>using (var model = connection.CreateModel())</div><div>{</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>model.ExchangeDeclare(&quot;TestExchange&quot;, ExchangeType.Direct);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>model.QueueDeclare(&quot;TestQueue&quot;);</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>model.QueueBind(&quot;TestQueue&quot;, &quot;TestExchange&quot;, &quot;TestRoute&quot;, false, null);</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>var client = new SimpleRpcClient(model, &quot;TestExchange&quot;, &quot;TestQueue&quot;, &quot;TestRoute&quot;);</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>client.TimeoutMilliseconds = 500;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>var request = Guid.NewGuid().ToString(&quot;N&quot;);</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>var requestData = Encoding.UTF32.GetBytes(request);</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>var requestProperties = model.CreateBasicProperties();</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>requestProperties.Expiration = &quot;1000&quot;;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>var responseData = client.Call(requestProperties, requestData);</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if (responseData == null)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>Console.Out.WriteLine(&quot;{0}: Timed Out&quot;, request);</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>else</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>Console.Out.WriteLine(&quot;{0}: {1}&quot;, request, Encoding.UTF32.GetString(responseData.Body));</div>
<div>}</div><div><br></div><div>Thanks,</div><div>Bryan</div></div>