@@ -73,15 +73,15 @@ create_super_stream(VirtualHost,
73
73
Name ,
74
74
Partitions ,
75
75
Arguments ,
76
- RoutingKeys ,
76
+ BindingKeys ,
77
77
Username ) ->
78
78
gen_server :call (? MODULE ,
79
79
{create_super_stream ,
80
80
VirtualHost ,
81
81
Name ,
82
82
Partitions ,
83
83
Arguments ,
84
- RoutingKeys ,
84
+ BindingKeys ,
85
85
Username }).
86
86
87
87
-spec delete_super_stream (binary (), binary (), binary ()) ->
@@ -226,10 +226,10 @@ handle_call({create_super_stream,
226
226
Name ,
227
227
Partitions ,
228
228
Arguments ,
229
- RoutingKeys ,
229
+ BindingKeys ,
230
230
Username },
231
231
_From , State ) ->
232
- case validate_super_stream_creation (VirtualHost , Name , Partitions ) of
232
+ case validate_super_stream_creation (VirtualHost , Name , Partitions , BindingKeys ) of
233
233
{error , Reason } ->
234
234
{reply , {error , Reason }, State };
235
235
ok ->
@@ -273,7 +273,7 @@ handle_call({create_super_stream,
273
273
add_super_stream_bindings (VirtualHost ,
274
274
Name ,
275
275
Partitions ,
276
- RoutingKeys ,
276
+ BindingKeys ,
277
277
Username ),
278
278
case BindingsResult of
279
279
ok ->
@@ -445,8 +445,8 @@ handle_call({route, RoutingKey, VirtualHost, SuperStream}, _From,
445
445
end
446
446
catch
447
447
exit :Error ->
448
- rabbit_log :error (" Error while looking up exchange ~tp , ~tp " ,
449
- [rabbit_misc :rs (ExchangeName ), Error ]),
448
+ rabbit_log :warning (" Error while looking up exchange ~tp , ~tp " ,
449
+ [rabbit_misc :rs (ExchangeName ), Error ]),
450
450
{error , stream_not_found }
451
451
end ,
452
452
{reply , Res , State };
@@ -655,7 +655,10 @@ super_stream_partitions(VirtualHost, SuperStream) ->
655
655
{error , stream_not_found }
656
656
end .
657
657
658
- validate_super_stream_creation (VirtualHost , Name , Partitions ) ->
658
+ validate_super_stream_creation (_VirtualHost , _Name , Partitions , BindingKeys )
659
+ when length (Partitions ) =/= length (BindingKeys ) ->
660
+ {error , {validation_failed , " There must be the same number of partitions and binding keys" }};
661
+ validate_super_stream_creation (VirtualHost , Name , Partitions , _BindingKeys ) ->
659
662
case exchange_exists (VirtualHost , Name ) of
660
663
{error , validation_failed } ->
661
664
{error ,
@@ -758,15 +761,15 @@ declare_super_stream_exchange(VirtualHost, Name, Username) ->
758
761
add_super_stream_bindings (VirtualHost ,
759
762
Name ,
760
763
Partitions ,
761
- RoutingKeys ,
764
+ BindingKeys ,
762
765
Username ) ->
763
- PartitionsRoutingKeys = lists :zip (Partitions , RoutingKeys ),
766
+ PartitionsBindingKeys = lists :zip (Partitions , BindingKeys ),
764
767
BindingsResult =
765
- lists :foldl (fun ({Partition , RoutingKey }, {ok , Order }) ->
768
+ lists :foldl (fun ({Partition , BindingKey }, {ok , Order }) ->
766
769
case add_super_stream_binding (VirtualHost ,
767
770
Name ,
768
771
Partition ,
769
- RoutingKey ,
772
+ BindingKey ,
770
773
Order ,
771
774
Username )
772
775
of
@@ -778,7 +781,7 @@ add_super_stream_bindings(VirtualHost,
778
781
(_ , {{error , _Reason }, _Order } = Acc ) ->
779
782
Acc
780
783
end ,
781
- {ok , 0 }, PartitionsRoutingKeys ),
784
+ {ok , 0 }, PartitionsBindingKeys ),
782
785
case BindingsResult of
783
786
{ok , _ } ->
784
787
ok ;
@@ -789,7 +792,7 @@ add_super_stream_bindings(VirtualHost,
789
792
add_super_stream_binding (VirtualHost ,
790
793
SuperStream ,
791
794
Partition ,
792
- RoutingKey ,
795
+ BindingKey ,
793
796
Order ,
794
797
Username ) ->
795
798
{ok , ExchangeNameBin } =
@@ -806,7 +809,7 @@ add_super_stream_binding(VirtualHost,
806
809
Order ),
807
810
case rabbit_binding :add (# binding {source = ExchangeName ,
808
811
destination = QueueName ,
809
- key = RoutingKey ,
812
+ key = BindingKey ,
810
813
args = Arguments },
811
814
fun (_X , Q ) when ? is_amqqueue (Q ) ->
812
815
try
0 commit comments