UI bits for consumer timeout

This commit is contained in:
Iliia Khaprov 2023-05-22 10:54:51 +02:00
parent c02ca3b52b
commit 00b3a895f1
4 changed files with 31 additions and 1 deletions

View File

@ -191,6 +191,9 @@ var HELP = {
'queue-message-ttl':
'How long a message published to a queue can live before it is discarded (milliseconds).<br/>(Sets the "<a target="_blank" href="https://rabbitmq.com/ttl.html#per-queue-message-ttl">x-message-ttl</a>" argument.)',
'queue-consumer-timeout':
'If a consumer does not ack its delivery for more than the <a href="https://www.rabbitmq.com/consumers.html#acknowledgement-timeout">timeout value</a> (30 minutes by default), its channel will be closed with a <code>PRECONDITION_FAILED</code> channel exception.',
'queue-expires':
'How long a queue can be unused for before it is automatically deleted (milliseconds).<br/>(Sets the "<a target="_blank" href="https://rabbitmq.com/ttl.html#queue-ttl">x-expires</a>" argument.)',

View File

@ -14,6 +14,7 @@
<th>Prefetch count</th>
<th>Active <span class="help" id="consumer-active"></span></th>
<th>Activity status</th>
<th>Consumer Timeout</th>
<th>Arguments</th>
</tr>
</thead>
@ -34,6 +35,7 @@
<td class="c"><%= consumer.prefetch_count %></td>
<td class="c"><%= fmt_boolean(consumer.active) %></td>
<td class="c"><%= fmt_activity_status(consumer.activity_status) %></td>
<td class="c"><%= consumer.consumer_timeout %></td>
<td class="c"><%= fmt_table_short(consumer.arguments) %></td>
</tr>
<% } %>

View File

@ -108,6 +108,7 @@
<span class="argument-link" field="definition" key="dead-letter-exchange" type="string">Dead letter exchange</span> |
<span class="argument-link" field="definition" key="dead-letter-routing-key" type="string">Dead letter routing key</span><br/>
<span class="argument-link" field="definition" key="message-ttl" type="number">Message TTL</span><span class="help" id="queue-message-ttl"></span></br>
<span class="argument-link" field="definition" key="consumer-timeout" type="number">Consumer Timeout</span><span class="help" id="queue-consumer-timeout"></span></br>
</td>
<tr>
<td>Queues [Classic]</td>

View File

@ -252,7 +252,31 @@ augment_consumer({{Q, Ch, CTag}, Props}) ->
[{queue, format_resource(Q)},
{channel_details, augment_channel_pid(Ch)},
{channel_pid, Ch},
{consumer_tag, CTag} | Props].
{consumer_tag, CTag},
{consumer_timeout, consumer_timeout(Props, Q)} | Props].
consumer_timeout(_Props, Q) ->
get_queue_consumer_timeout(Q, get_global_consumer_timeout()).
get_queue_consumer_timeout(QName, GCT) ->
case rabbit_amqqueue:lookup(QName) of
{ok, Q} -> %% should we account for different queue states here?
case rabbit_queue_type_util:args_policy_lookup(<<"consumer-timeout">>,
fun (X, Y) -> erlang:min(X, Y) end, Q) of
undefined -> GCT;
Val -> Val
end;
_ ->
GCT
end.
get_global_consumer_timeout() ->
case application:get_env(rabbit, consumer_timeout) of
{ok, MS} when is_integer(MS) ->
MS;
_ ->
undefined
end.
consumers_by_vhost(VHost) ->
ets:select(consumer_stats,