Commits

Anonymous committed 5ca8eb0

Update API compatibility

Comments (0)

Files changed (2)

src/bql_applicator.erl

 apply_command({create_queue, Name, Durable, Args}, #state {user = Username, vhost = VHost}) ->
     QueueName = rabbit_misc:r(VHost, queue, list_to_binary(Name)),
     ensure_resource_access(Username, QueueName, configure),
-    rabbit_amqqueue:declare(QueueName, Durable, false, Args),
+    rabbit_amqqueue:declare(QueueName, Durable, false, Args, none),
     ok;
 apply_command({drop_queue, Name}, #state {user = Username, vhost = VHost}) ->
     QueueName = rabbit_misc:r(VHost, queue, list_to_binary(Name)),
                rabbit_exchange:declare(ExchangeName, CheckedType,
                                        Durable, false, Args)
        end,
-    ok = rabbit_exchange:assert_type(X, CheckedType),
+    ok = rabbit_exchange:assert_equivalence(X, CheckedType, Durable,
+                                            false, Args),
     ok;
 apply_command({drop_exchange, Name}, #state {user = Username, vhost = VHost}) ->
     ExchangeName = rabbit_misc:r(VHost, exchange, list_to_binary(Name)),
 
 % Binding Management
 apply_command({create_binding, {X, Q, RoutingKey}, Args}, #state {user = Username, vhost = VHost}) ->
-    binding_action(fun rabbit_exchange:add_binding/4, 
+    binding_action(fun rabbit_exchange:add_binding/5, 
                    list_to_binary(X), list_to_binary(Q),
                    list_to_binary(RoutingKey), Args, Username, VHost);
 apply_command({drop_binding, {X, Q, RoutingKey}}, #state {user = Username, vhost = VHost}) ->
-    binding_action(fun rabbit_exchange:delete_binding/4, 
+    binding_action(fun rabbit_exchange:delete_binding/5, 
                    list_to_binary(X), list_to_binary(Q),
                    list_to_binary(RoutingKey), <<"">>, Username, VHost);
 
     ensure_resource_access(Username, QueueName, write),
     ExchangeName = rabbit_misc:r(VHost, exchange, ExchangeNameBin),
     ensure_resource_access(Username, ExchangeName, read),
-    case Fun(ExchangeName, QueueName, RoutingKey, Arguments) of
+    case Fun(ExchangeName, QueueName, RoutingKey, Arguments, fun (_X, _Q) -> ok end) of
         {error, exchange_not_found} ->
             lists:flatten(io_lib:format("~s not found", [rabbit_misc:rs(ExchangeName)]));
         {error, queue_not_found} ->

test/bql_test.erl

 create_route_from_nondurable_exchange_to_durable_queue_test() ->
     [ok] = execute("create exchange nondurableexchange"),
     [ok] = execute("create durable queue mydurablequeue"),
-    ?assertEqual(["Durability settings of " ++
-                  "queue 'mydurablequeue' in vhost '/' " ++
-                  "incompatible with exchange 'nondurableexchange' in vhost '/'"],
+    ?assertEqual([ok],
                  execute("create route from nondurableexchange to mydurablequeue")).
 
 select_permission_with_where_clause_not_in_result_test() ->