diff options
Diffstat (limited to 'deps/rabbitmq_stomp/src/rabbit_stomp_internal_event_handler.erl')
-rw-r--r-- | deps/rabbitmq_stomp/src/rabbit_stomp_internal_event_handler.erl | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/deps/rabbitmq_stomp/src/rabbit_stomp_internal_event_handler.erl b/deps/rabbitmq_stomp/src/rabbit_stomp_internal_event_handler.erl new file mode 100644 index 0000000000..47331312ce --- /dev/null +++ b/deps/rabbitmq_stomp/src/rabbit_stomp_internal_event_handler.erl @@ -0,0 +1,46 @@ +%% The contents of this file are subject to the Mozilla Public License +%% Version 1.1 (the "License"); you may not use this file except in +%% compliance with the License. You may obtain a copy of the License +%% at https://www.mozilla.org/MPL/ +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and +%% limitations under the License. +%% +%% The Original Code is RabbitMQ. +%% +%% The Initial Developer of the Original Code is GoPivotal, Inc. +%% Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. +%% + +-module(rabbit_stomp_internal_event_handler). + +-behaviour(gen_event). + +-export([init/1, handle_event/2, handle_call/2, handle_info/2, terminate/2, code_change/3]). + +-import(rabbit_misc, [pget/2]). + +init([]) -> + {ok, []}. + +handle_event({event, maintenance_connections_closed, _Info, _, _}, State) -> + %% we should close our connections + {ok, NConnections} = rabbit_stomp:close_all_client_connections("node is being put into maintenance mode"), + rabbit_log:alert("Closed ~b local STOMP client connections", [NConnections]), + {ok, State}; +handle_event(_Event, State) -> + {ok, State}. + +handle_call(_Request, State) -> + {ok, State}. + +handle_info(_Info, State) -> + {ok, State}. + +terminate(_Reason, _State) -> + ok. + +code_change(_OldVsn, State, _Extra) -> + {ok, State}. |