|
107 | 107 |
|
108 | 108 | %%----------------------------------------------------------------------------
|
109 | 109 |
|
| 110 | +-rabbit_deprecated_feature( |
| 111 | + {transient_nonexcl_queues, |
| 112 | + #{deprecation_phase => permitted_by_default, |
| 113 | + doc_url => "https://blog.rabbitmq.com/posts/2021/08/4.0-deprecation-announcements/#removal-of-transient-non-exclusive-queues" |
| 114 | + }}). |
| 115 | + |
110 | 116 | -define(CONSUMER_INFO_KEYS,
|
111 | 117 | [queue_name, channel_pid, consumer_tag, ack_required, prefetch_count,
|
112 | 118 | active, activity_status, arguments]).
|
@@ -223,7 +229,14 @@ declare(QueueName = #resource{virtual_host = VHost}, Durable, AutoDelete, Args,
|
223 | 229 | VHost,
|
224 | 230 | #{user => ActingUser},
|
225 | 231 | Type),
|
226 |
| - rabbit_queue_type:declare(Q, Node); |
| 232 | + case is_queue_args_combination_permitted(Q) of |
| 233 | + true -> |
| 234 | + rabbit_queue_type:declare(Q, Node); |
| 235 | + false -> |
| 236 | + Warning = rabbit_deprecated_features:get_warning( |
| 237 | + transient_nonexcl_queues), |
| 238 | + {protocol_error, internal_error, "~ts", [Warning]} |
| 239 | + end; |
227 | 240 | false ->
|
228 | 241 | {protocol_error, internal_error,
|
229 | 242 | "Cannot declare a queue '~ts' of type '~ts' on node '~ts': "
|
@@ -721,8 +734,11 @@ augment_declare_args(VHost, Durable, Exclusive, AutoDelete, Args0) ->
|
721 | 734 | when is_binary(DefaultQueueType) andalso
|
722 | 735 | not HasQTypeArg ->
|
723 | 736 | Type = rabbit_queue_type:discover(DefaultQueueType),
|
724 |
| - case rabbit_queue_type:is_compatible(Type, Durable, |
725 |
| - Exclusive, AutoDelete) of |
| 737 | + IsPermitted = is_queue_args_combination_permitted( |
| 738 | + Durable, Exclusive), |
| 739 | + IsCompatible = rabbit_queue_type:is_compatible( |
| 740 | + Type, Durable, Exclusive, AutoDelete), |
| 741 | + case IsPermitted andalso IsCompatible of |
726 | 742 | true ->
|
727 | 743 | %% patch up declare arguments with x-queue-type if there
|
728 | 744 | %% is a vhost default set the queue is druable and not exclusive
|
@@ -2074,3 +2090,16 @@ get_bcc_queue(Q, BCCName) ->
|
2074 | 2090 | #resource{virtual_host = VHost} = amqqueue:get_name(Q),
|
2075 | 2091 | BCCQueueName = rabbit_misc:r(VHost, queue, BCCName),
|
2076 | 2092 | rabbit_amqqueue:lookup(BCCQueueName).
|
| 2093 | + |
| 2094 | +is_queue_args_combination_permitted(Q) -> |
| 2095 | + Durable = amqqueue:is_durable(Q), |
| 2096 | + Exclusive = is_exclusive(Q), |
| 2097 | + is_queue_args_combination_permitted(Durable, Exclusive). |
| 2098 | + |
| 2099 | +is_queue_args_combination_permitted(Durable, Exclusive) -> |
| 2100 | + case not Durable andalso not Exclusive of |
| 2101 | + false -> |
| 2102 | + true; |
| 2103 | + true -> |
| 2104 | + rabbit_deprecated_features:is_permitted(transient_nonexcl_queues) |
| 2105 | + end. |
0 commit comments