@@ -133,7 +133,8 @@ amqp10_src_validation(_Def, User) ->
133133 {<<" src-uri" >>, validate_uri_fun (User ), mandatory },
134134 {<<" src-address" >>, fun rabbit_parameter_validation :binary /2 , mandatory },
135135 {<<" src-prefetch-count" >>, fun rabbit_parameter_validation :number /2 , optional },
136- {<<" src-delete-after" >>, fun validate_delete_after /2 , optional }
136+ {<<" src-delete-after" >>, fun validate_delete_after /2 , optional },
137+ {<<" src-capabilities" >>, fun validate_link_capabilities /2 , optional }
137138 ].
138139
139140amqp091_src_validation (_Def , User ) ->
@@ -168,7 +169,8 @@ amqp10_dest_validation(_Def, User) ->
168169 {<<" dest-application-properties" >>, fun validate_amqp10_map /2 , optional },
169170 {<<" dest-message-annotations" >>, fun validate_amqp10_map /2 , optional },
170171 % TODO: restrict to allowed fields
171- {<<" dest-properties" >>, fun validate_amqp10_map /2 , optional }
172+ {<<" dest-properties" >>, fun validate_amqp10_map /2 , optional },
173+ {<<" dest-capabilities" >>, fun validate_link_capabilities /2 , optional }
172174 ].
173175
174176amqp091_dest_validation (_Def , User ) ->
@@ -226,6 +228,19 @@ validate_params_user(#amqp_params_direct{virtual_host = VHost},
226228validate_params_user (# amqp_params_network {}, _User ) ->
227229 ok .
228230
231+ validate_link_capabilities (Name , ListOfSymbols ) when is_list (ListOfSymbols ) ->
232+ case lists :all (fun (V ) when is_binary (V ) -> true ;
233+ (_V ) -> false
234+ end , ListOfSymbols ) of
235+ true -> ok ;
236+ false -> {error , " ~ts should have list of binaries, actually was ~tp " ,
237+ [Name , ListOfSymbols ]}
238+ end ;
239+ validate_link_capabilities (_Name , Symbol ) when is_binary (Symbol ) ->
240+ ok ;
241+ validate_link_capabilities (Name , Symbol ) ->
242+ {error , " ~ts should be a binary, actually was ~tp " , [Name , Symbol ]}.
243+
229244validate_delete_after (_Name , <<" never" >>) -> ok ;
230245validate_delete_after (_Name , <<" queue-length" >>) -> ok ;
231246validate_delete_after (_Name , N ) when is_integer (N ), N >= 0 -> ok ;
@@ -314,11 +329,13 @@ parse_amqp10_dest({_VHost, _Name}, _ClusterName, Def, SourceHeaders) ->
314329 MessageAnns =
315330 rabbit_data_coercion :to_proplist (
316331 pget (<<" dest-message-annotations" >>, Def , [])),
332+ ReceiverCapabilities = pget (<<" dest-capabilities" >>, Def ),
317333 #{module => rabbit_amqp10_shovel ,
318334 uris => Uris ,
319335 target_address => Address ,
320336 message_annotations => maps :from_list (MessageAnns ),
321337 application_properties => maps :from_list (AppProperties ++ SourceHeaders ),
338+ receiver_capabilities => ReceiverCapabilities ,
322339 properties => maps :from_list (
323340 lists :map (fun ({K , V }) ->
324341 {rabbit_data_coercion :to_atom (K ), V }
@@ -416,12 +433,14 @@ parse_amqp10_source(Def) ->
416433 Address = pget (<<" src-address" >>, Def ),
417434 DeleteAfter = pget (<<" src-delete-after" >>, Def , <<" never" >>),
418435 PrefetchCount = pget (<<" src-prefetch-count" >>, Def , 1000 ),
436+ SenderCapabilities = pget (<<" src-capabilities" >>, Def ),
419437 Headers = [],
420438 {#{module => rabbit_amqp10_shovel ,
421439 uris => Uris ,
422440 source_address => Address ,
423441 delete_after => opt_b2a (DeleteAfter ),
424442 prefetch_count => PrefetchCount ,
443+ sender_capabilities => SenderCapabilities ,
425444 consumer_args => []}, Headers }.
426445
427446parse_amqp091_source (Def ) ->
0 commit comments