1%% This Source Code Form is subject to the terms of the Mozilla Public
2%% License, v. 2.0. If a copy of the MPL was not distributed with this
3%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
4%%
5%% Copyright (c) 2007-2021 VMware, Inc. or its affiliates.  All rights reserved.
6%%
7
8-module(rabbit_exchange_type_invalid).
9-include_lib("rabbit_common/include/rabbit.hrl").
10
11-behaviour(rabbit_exchange_type).
12
13-export([description/0, serialise_events/0, route/2]).
14-export([validate/1, validate_binding/2,
15         create/2, delete/3, policy_changed/2, add_binding/3,
16         remove_bindings/3, assert_args_equivalence/2]).
17-export([info/1, info/2]).
18
19info(_X) -> [].
20info(_X, _) -> [].
21
22description() ->
23    [{description,
24      <<"Dummy exchange type, to be used when the intended one is not found.">>
25     }].
26
27serialise_events() -> false.
28
29-spec route(rabbit_types:exchange(), rabbit_types:delivery()) -> no_return().
30
31route(#exchange{name = Name, type = Type}, _) ->
32    rabbit_misc:protocol_error(
33      precondition_failed,
34      "Cannot route message through ~s: exchange type ~s not found",
35      [rabbit_misc:rs(Name), Type]).
36
37validate(_X) -> ok.
38validate_binding(_X, _B) -> ok.
39create(_Tx, _X) -> ok.
40delete(_Tx, _X, _Bs) -> ok.
41policy_changed(_X1, _X2) -> ok.
42add_binding(_Tx, _X, _B) -> ok.
43remove_bindings(_Tx, _X, _Bs) -> ok.
44assert_args_equivalence(X, Args) ->
45    rabbit_exchange:assert_args_equivalence(X, Args).
46