diff --git a/LICENSE b/LICENSE index 58c43e7..9deeb23 100644 --- a/LICENSE +++ b/LICENSE @@ -96,7 +96,7 @@ Authors and Copyright are as described below: The Initial Developer of the Original Code is GoPivotal, Inc. - Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. + Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. MOZILLA PUBLIC LICENSE @@ -548,7 +548,7 @@ The Original Code is RabbitMQ. The Initial Developer of the Original Code is GoPivotal, Inc. - Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved.'' + Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved.'' [NOTE: The text of this Exhibit A may differ slightly from the text of the notices in the Source Code files of the Original Code. You should diff --git a/Makefile b/Makefile index 50c6c76..1c98001 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,9 @@ ifeq ($(shell python -c 'import simplejson' 2>/dev/null && echo yes),yes) PYTHON=python else +ifeq ($(shell python2.7 -c 'import json' 2>/dev/null && echo yes),yes) +PYTHON=python2.7 +else ifeq ($(shell python2.6 -c 'import simplejson' 2>/dev/null && echo yes),yes) PYTHON=python2.6 else @@ -37,6 +40,7 @@ else # Hmm. Missing simplejson? PYTHON=python +endif endif endif endif @@ -226,7 +230,7 @@ $(BASIC_SCRIPT_ENVIRONMENT_SETTINGS) \ RABBITMQ_NODE_ONLY=true \ RABBITMQ_SERVER_START_ARGS="$(RABBITMQ_SERVER_START_ARGS)" \ - ./scripts/rabbitmq-server + ./scripts/rabbitmq-server -detached run-tests: all echo 'code:add_path("$(TEST_EBIN_DIR)").' | $(ERL_CALL) @@ -242,7 +246,12 @@ start-background-node: all -rm -f $(RABBITMQ_MNESIA_DIR).pid mkdir -p $(RABBITMQ_MNESIA_DIR) - nohup sh -c "$(MAKE) run-background-node > $(RABBITMQ_MNESIA_DIR)/startup_log 2> $(RABBITMQ_MNESIA_DIR)/startup_err" > /dev/null & + $(BASIC_SCRIPT_ENVIRONMENT_SETTINGS) \ + RABBITMQ_NODE_ONLY=true \ + RABBITMQ_SERVER_START_ARGS="$(RABBITMQ_SERVER_START_ARGS)" \ + ./scripts/rabbitmq-server \ + > $(RABBITMQ_MNESIA_DIR)/startup_log \ + 2> $(RABBITMQ_MNESIA_DIR)/startup_err & ./scripts/rabbitmqctl -n $(RABBITMQ_NODENAME) wait $(RABBITMQ_MNESIA_DIR).pid kernel start-rabbit-on-node: all diff --git a/codegen.py b/codegen.py index b2356bb..9f16b32 100644 --- a/codegen.py +++ b/codegen.py @@ -11,7 +11,7 @@ ## The Original Code is RabbitMQ. ## ## The Initial Developer of the Original Code is GoPivotal, Inc. -## Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +## Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. ## from __future__ import nested_scopes @@ -106,7 +106,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %%""" def genErl(spec): diff --git a/docs/rabbitmqctl.1.xml b/docs/rabbitmqctl.1.xml index 40d8978..92d4846 100644 --- a/docs/rabbitmqctl.1.xml +++ b/docs/rabbitmqctl.1.xml @@ -41,6 +41,7 @@ rabbitmqctl -n node + -t timeout -q command command options @@ -92,6 +93,15 @@ + + -t timeout + + + Operation timeout in seconds. Only applicable to "list" commands. + Default is "infinity". + + + @@ -576,6 +586,25 @@ Instructs a synchronising mirrored queue to stop synchronising itself. + + + + + purge_queue queue + + + + + queue + + + The name of the queue to purge. + + + + + + Purges a queue (removes all messages in it). diff --git a/ebin/rabbit_app.in b/ebin/rabbit_app.in index 9085928..df58ba3 100644 --- a/ebin/rabbit_app.in +++ b/ebin/rabbit_app.in @@ -1,7 +1,7 @@ {application, rabbit, %% -*- erlang -*- [{description, "RabbitMQ"}, {id, "RabbitMQ"}, - {vsn, "3.5.1"}, + {vsn, "3.5.4"}, {modules, []}, {registered, [rabbit_amqqueue_sup, rabbit_log, @@ -79,5 +79,7 @@ mnesia_lib, rpc, mnesia_tm, qlc, sofs, proplists, credit_flow, pmon, ssl_connection, tls_connection, ssl_record, tls_record, gen_fsm, ssl]}, - {ssl_apps, [asn1, crypto, public_key, ssl]} + {ssl_apps, [asn1, crypto, public_key, ssl]}, + %% see rabbitmq-server#114 + {mirroring_flow_control, true} ]}]}. diff --git a/include/gm_specs.hrl b/include/gm_specs.hrl index d8686cd..5a98e70 100644 --- a/include/gm_specs.hrl +++ b/include/gm_specs.hrl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -ifdef(use_specs). diff --git a/include/rabbit.hrl b/include/rabbit.hrl index 7627ed4..ddcfd6a 100644 --- a/include/rabbit.hrl +++ b/include/rabbit.hrl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% Passed around most places @@ -104,7 +104,7 @@ %%---------------------------------------------------------------------------- --define(COPYRIGHT_MESSAGE, "Copyright (C) 2007-2014 GoPivotal, Inc."). +-define(COPYRIGHT_MESSAGE, "Copyright (C) 2007-2015 Pivotal Software, Inc."). -define(INFORMATION_MESSAGE, "Licensed under the MPL. See http://www.rabbitmq.com/"). -define(ERTS_MINIMUM, "5.6.3"). diff --git a/include/rabbit_cli.hrl b/include/rabbit_cli.hrl index ddb4f4d..1bffc9a 100644 --- a/include/rabbit_cli.hrl +++ b/include/rabbit_cli.hrl @@ -11,12 +11,13 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -define(NODE_OPT, "-n"). -define(QUIET_OPT, "-q"). -define(VHOST_OPT, "-p"). +-define(TIMEOUT_OPT, "-t"). -define(VERBOSE_OPT, "-v"). -define(MINIMAL_OPT, "-m"). @@ -33,6 +34,7 @@ -define(NODE_DEF(Node), {?NODE_OPT, {option, Node}}). -define(QUIET_DEF, {?QUIET_OPT, flag}). -define(VHOST_DEF, {?VHOST_OPT, {option, "/"}}). +-define(TIMEOUT_DEF, {?TIMEOUT_OPT, {option, "infinity"}}). -define(VERBOSE_DEF, {?VERBOSE_OPT, flag}). -define(MINIMAL_DEF, {?MINIMAL_OPT, flag}). diff --git a/include/rabbit_msg_store.hrl b/include/rabbit_msg_store.hrl index 4e726b0..803ed6b 100644 --- a/include/rabbit_msg_store.hrl +++ b/include/rabbit_msg_store.hrl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -include("rabbit.hrl"). diff --git a/plugins-src/Makefile b/plugins-src/Makefile index 0ded33f..4ab8c86 100644 --- a/plugins-src/Makefile +++ b/plugins-src/Makefile @@ -57,6 +57,10 @@ VERSION:=0.0.0 +ifndef VERBOSE +QUIET:=@ +endif + #---------------------------------- all: @@ -118,14 +122,18 @@ #---------------------------------- $(REPOS): - retries=5; \ - while ! git clone $(GIT_CORE_REPOBASE_FETCH)/$@$(GIT_CORE_SUFFIX_FETCH); do \ + $(QUIET)retries=5; \ + umbrella_branch="$$(git branch | awk '/^\* / { print $$2; }')"; \ + if test "$$umbrella_branch" = "stable"; then \ + branch_arg="-b $$umbrella_branch"; \ + fi; \ + while ! git clone $$branch_arg $(GIT_CORE_REPOBASE_FETCH)/$@$(GIT_CORE_SUFFIX_FETCH); do \ retries=$$((retries - 1)); \ if test "$$retries" = 0; then break; fi; \ sleep 1; \ done - test -d $@ - global_user_name="$$(git config --global user.name)"; \ + $(QUIET)test -d $@ + $(QUIET)global_user_name="$$(git config --global user.name)"; \ global_user_email="$$(git config --global user.email)"; \ user_name="$$(git config user.name)"; \ user_email="$$(git config user.email)"; \ @@ -160,7 +168,7 @@ sync-gitremote: @for repo in $(REPOS); do \ cd $$repo && \ - git remote set-url --fetch origin $(GIT_CORE_REPOBASE_FETCH)/$$repo$(GIT_CORE_SUFFIX_FETCH) && \ + git remote set-url origin $(GIT_CORE_REPOBASE_FETCH)/$$repo$(GIT_CORE_SUFFIX_FETCH) && \ git remote set-url --push origin $(GIT_CORE_REPOBASE_PUSH)/$$repo$(GIT_CORE_SUFFIX_PUSH) && \ cd ..; done @@ -200,7 +208,8 @@ pull: $(foreach DIR,. $(REPOS),$(DIR)+pull) $(eval $(call repo_targets,. $(REPOS),pull,| %,\ - (cd % && git pull --ff-only))) + (cd % && git fetch -p && \ + (! git symbolic-ref -q HEAD || git pull --ff-only)))) .PHONY: update update: pull @@ -210,8 +219,7 @@ $(eval $(call repo_targets,. $(REPOS),named_update,| %,\ (cd % && git fetch -p && git checkout $(BRANCH) && \ - (test "$$$$(git branch | grep '^*')" = "* (detached from $(BRANCH))" || \ - git pull --ff-only)))) + (! git symbolic-ref -q HEAD || git pull --ff-only)))) .PHONY: tag tag: $(foreach DIR,. $(REPOS),$(DIR)+tag) diff --git a/plugins-src/do-package.mk b/plugins-src/do-package.mk index 86cd764..b76c9a5 100644 --- a/plugins-src/do-package.mk +++ b/plugins-src/do-package.mk @@ -310,7 +310,8 @@ set --offline $$$$(RABBITMQ_PLUGINS_DIR=$(TEST_TMPDIR)/plugins \ RABBITMQ_ENABLED_PLUGINS_FILE=$(TEST_TMPDIR)/enabled_plugins \ $(UMBRELLA_BASE_DIR)/rabbitmq-server/scripts/rabbitmq-plugins list -m | tr '\n' ' ') - RABBITMQ_PLUGINS_DIR=$(TEST_TMPDIR)/plugins \ + MAKE="$(MAKE)" \ + RABBITMQ_PLUGINS_DIR=$(TEST_TMPDIR)/plugins \ RABBITMQ_ENABLED_PLUGINS_FILE=$(TEST_TMPDIR)/enabled_plugins \ RABBITMQ_LOG_BASE=$(TEST_TMPDIR)/log \ RABBITMQ_MNESIA_BASE=$(TEST_TMPDIR)/$(NODENAME) \ @@ -339,13 +340,14 @@ | $(ERL_CALL) $(ERL_CALL_OPTS) \ | tee -a $(TEST_TMPDIR)/rabbit-test-output \ | egrep "{ok, (ok|passed)}" >/dev/null &&) \ - $(foreach SCRIPT,$(WITH_BROKER_TEST_SCRIPTS),$(SCRIPT) &&) : ; \ + MAKE="$(MAKE)" RABBITMQ_NODENAME="$(NODENAME)" \ + $(foreach SCRIPT,$(WITH_BROKER_TEST_SCRIPTS),$(SCRIPT) &&) : ; \ then \ touch $(TEST_TMPDIR)/.passed ; \ - echo "\nPASSED\n" ; \ + printf "\nPASSED\n" ; \ else \ cat $(TEST_TMPDIR)/rabbit-test-output ; \ - echo "\n\nFAILED\n" ; \ + printf "\n\nFAILED\n" ; \ fi sleep 1 echo "rabbit_misc:report_cover(), init:stop()." | $(ERL_CALL) $(ERL_CALL_OPTS) diff --git a/plugins-src/rabbitmq-amqp1.0/test/swiftmq/Makefile b/plugins-src/rabbitmq-amqp1.0/test/swiftmq/Makefile index a6e538c..3a1c639 100644 --- a/plugins-src/rabbitmq-amqp1.0/test/swiftmq/Makefile +++ b/plugins-src/rabbitmq-amqp1.0/test/swiftmq/Makefile @@ -1,5 +1,5 @@ -CLIENT_DIR=swiftmq_9_2_5_client -CLIENT_PKG=$(CLIENT_DIR).zip +CLIENT_DIR=swiftmq_9_7_1_client +CLIENT_PKG=$(CLIENT_DIR).tar.gz .PHONY: test @@ -8,7 +8,7 @@ build/lib: $(CLIENT_PKG) mkdir -p build/tmp - unzip -d build/tmp $(CLIENT_PKG) + tar -zx -f $(CLIENT_PKG) -C build/tmp mkdir -p build/lib mv build/tmp/$(CLIENT_DIR)/jars/*.jar build/lib rm -rf build/tmp diff --git a/plugins-src/rabbitmq-auth-backend-ldap/src/rabbit_auth_backend_ldap.erl b/plugins-src/rabbitmq-auth-backend-ldap/src/rabbit_auth_backend_ldap.erl index f1e14aa..943ac55 100644 --- a/plugins-src/rabbitmq-auth-backend-ldap/src/rabbit_auth_backend_ldap.erl +++ b/plugins-src/rabbitmq-auth-backend-ldap/src/rabbit_auth_backend_ldap.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_auth_backend_ldap). diff --git a/plugins-src/rabbitmq-auth-backend-ldap/src/rabbit_auth_backend_ldap_app.erl b/plugins-src/rabbitmq-auth-backend-ldap/src/rabbit_auth_backend_ldap_app.erl index be224f1..e0cd7aa 100644 --- a/plugins-src/rabbitmq-auth-backend-ldap/src/rabbit_auth_backend_ldap_app.erl +++ b/plugins-src/rabbitmq-auth-backend-ldap/src/rabbit_auth_backend_ldap_app.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_auth_backend_ldap_app). diff --git a/plugins-src/rabbitmq-auth-backend-ldap/src/rabbit_auth_backend_ldap_util.erl b/plugins-src/rabbitmq-auth-backend-ldap/src/rabbit_auth_backend_ldap_util.erl index 8e00b35..47c3d66 100644 --- a/plugins-src/rabbitmq-auth-backend-ldap/src/rabbit_auth_backend_ldap_util.erl +++ b/plugins-src/rabbitmq-auth-backend-ldap/src/rabbit_auth_backend_ldap_util.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_auth_backend_ldap_util). diff --git a/plugins-src/rabbitmq-auth-backend-ldap/test/src/rabbit_auth_backend_ldap_test.erl b/plugins-src/rabbitmq-auth-backend-ldap/test/src/rabbit_auth_backend_ldap_test.erl index 72fbc84..2b92632 100644 --- a/plugins-src/rabbitmq-auth-backend-ldap/test/src/rabbit_auth_backend_ldap_test.erl +++ b/plugins-src/rabbitmq-auth-backend-ldap/test/src/rabbit_auth_backend_ldap_test.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_auth_backend_ldap_test). diff --git a/plugins-src/rabbitmq-auth-backend-ldap/test/src/rabbit_auth_backend_ldap_unit_test.erl b/plugins-src/rabbitmq-auth-backend-ldap/test/src/rabbit_auth_backend_ldap_unit_test.erl index 0db56c6..47223f9 100644 --- a/plugins-src/rabbitmq-auth-backend-ldap/test/src/rabbit_auth_backend_ldap_unit_test.erl +++ b/plugins-src/rabbitmq-auth-backend-ldap/test/src/rabbit_auth_backend_ldap_unit_test.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_auth_backend_ldap_unit_test). diff --git a/plugins-src/rabbitmq-auth-mechanism-ssl/src/rabbit_auth_mechanism_ssl.erl b/plugins-src/rabbitmq-auth-mechanism-ssl/src/rabbit_auth_mechanism_ssl.erl index 325b2e7..47cfcab 100644 --- a/plugins-src/rabbitmq-auth-mechanism-ssl/src/rabbit_auth_mechanism_ssl.erl +++ b/plugins-src/rabbitmq-auth-mechanism-ssl/src/rabbit_auth_mechanism_ssl.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% diff --git a/plugins-src/rabbitmq-auth-mechanism-ssl/src/rabbit_auth_mechanism_ssl_app.erl b/plugins-src/rabbitmq-auth-mechanism-ssl/src/rabbit_auth_mechanism_ssl_app.erl index 1867d3a..7f6eff9 100644 --- a/plugins-src/rabbitmq-auth-mechanism-ssl/src/rabbit_auth_mechanism_ssl_app.erl +++ b/plugins-src/rabbitmq-auth-mechanism-ssl/src/rabbit_auth_mechanism_ssl_app.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_auth_mechanism_ssl_app). diff --git a/plugins-src/rabbitmq-erlang-client/Makefile b/plugins-src/rabbitmq-erlang-client/Makefile index 71c3927..a42c666 100644 --- a/plugins-src/rabbitmq-erlang-client/Makefile +++ b/plugins-src/rabbitmq-erlang-client/Makefile @@ -11,7 +11,7 @@ # The Original Code is RabbitMQ. # # The Initial Developer of the Original Code is GoPivotal, Inc. -# Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +# Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. # VERSION=0.0.0 diff --git a/plugins-src/rabbitmq-erlang-client/Makefile.in b/plugins-src/rabbitmq-erlang-client/Makefile.in index 42ead35..0b46f9f 100644 --- a/plugins-src/rabbitmq-erlang-client/Makefile.in +++ b/plugins-src/rabbitmq-erlang-client/Makefile.in @@ -11,7 +11,7 @@ # The Original Code is RabbitMQ. # # The Initial Developer of the Original Code is GoPivotal, Inc. -# Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +# Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. # VERSION=%%VSN%% diff --git a/plugins-src/rabbitmq-erlang-client/common.mk b/plugins-src/rabbitmq-erlang-client/common.mk index 994d474..9de9221 100644 --- a/plugins-src/rabbitmq-erlang-client/common.mk +++ b/plugins-src/rabbitmq-erlang-client/common.mk @@ -11,7 +11,7 @@ # The Original Code is RabbitMQ. # # The Initial Developer of the Original Code is GoPivotal, Inc. -# Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +# Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. # # The client library can either be built from source control or by downloading diff --git a/plugins-src/rabbitmq-erlang-client/include/amqp_client.hrl b/plugins-src/rabbitmq-erlang-client/include/amqp_client.hrl index cc1f485..bc74dd7 100644 --- a/plugins-src/rabbitmq-erlang-client/include/amqp_client.hrl +++ b/plugins-src/rabbitmq-erlang-client/include/amqp_client.hrl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -ifndef(AMQP_CLIENT_HRL). diff --git a/plugins-src/rabbitmq-erlang-client/include/amqp_client_internal.hrl b/plugins-src/rabbitmq-erlang-client/include/amqp_client_internal.hrl index bdaf9c2..f990f04 100644 --- a/plugins-src/rabbitmq-erlang-client/include/amqp_client_internal.hrl +++ b/plugins-src/rabbitmq-erlang-client/include/amqp_client_internal.hrl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -include("amqp_client.hrl"). diff --git a/plugins-src/rabbitmq-erlang-client/include/amqp_gen_consumer_spec.hrl b/plugins-src/rabbitmq-erlang-client/include/amqp_gen_consumer_spec.hrl index dda4993..fbaa28c 100644 --- a/plugins-src/rabbitmq-erlang-client/include/amqp_gen_consumer_spec.hrl +++ b/plugins-src/rabbitmq-erlang-client/include/amqp_gen_consumer_spec.hrl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2011-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2011-2015 Pivotal Software, Inc. All rights reserved. %% -include("amqp_client.hrl"). diff --git a/plugins-src/rabbitmq-erlang-client/include/rabbit_routing_prefixes.hrl b/plugins-src/rabbitmq-erlang-client/include/rabbit_routing_prefixes.hrl index 79e41ca..34618c5 100644 --- a/plugins-src/rabbitmq-erlang-client/include/rabbit_routing_prefixes.hrl +++ b/plugins-src/rabbitmq-erlang-client/include/rabbit_routing_prefixes.hrl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2011-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2011-2015 Pivotal Software, Inc. All rights reserved. %% -define(QUEUE_PREFIX, "/queue"). diff --git a/plugins-src/rabbitmq-erlang-client/src/amqp_auth_mechanisms.erl b/plugins-src/rabbitmq-erlang-client/src/amqp_auth_mechanisms.erl index 576cdc1..9192cad 100644 --- a/plugins-src/rabbitmq-erlang-client/src/amqp_auth_mechanisms.erl +++ b/plugins-src/rabbitmq-erlang-client/src/amqp_auth_mechanisms.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% @private diff --git a/plugins-src/rabbitmq-erlang-client/src/amqp_channel.erl b/plugins-src/rabbitmq-erlang-client/src/amqp_channel.erl index 2e626b4..1121795 100644 --- a/plugins-src/rabbitmq-erlang-client/src/amqp_channel.erl +++ b/plugins-src/rabbitmq-erlang-client/src/amqp_channel.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% @type close_reason(Type) = {shutdown, amqp_reason(Type)}. diff --git a/plugins-src/rabbitmq-erlang-client/src/amqp_channel_sup.erl b/plugins-src/rabbitmq-erlang-client/src/amqp_channel_sup.erl index b499d46..8fc4d8f 100644 --- a/plugins-src/rabbitmq-erlang-client/src/amqp_channel_sup.erl +++ b/plugins-src/rabbitmq-erlang-client/src/amqp_channel_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% @private diff --git a/plugins-src/rabbitmq-erlang-client/src/amqp_channel_sup_sup.erl b/plugins-src/rabbitmq-erlang-client/src/amqp_channel_sup_sup.erl index 2108b6a..6d461e1 100644 --- a/plugins-src/rabbitmq-erlang-client/src/amqp_channel_sup_sup.erl +++ b/plugins-src/rabbitmq-erlang-client/src/amqp_channel_sup_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% @private diff --git a/plugins-src/rabbitmq-erlang-client/src/amqp_channels_manager.erl b/plugins-src/rabbitmq-erlang-client/src/amqp_channels_manager.erl index e805ea1..b260cd2 100644 --- a/plugins-src/rabbitmq-erlang-client/src/amqp_channels_manager.erl +++ b/plugins-src/rabbitmq-erlang-client/src/amqp_channels_manager.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% @private diff --git a/plugins-src/rabbitmq-erlang-client/src/amqp_client.erl b/plugins-src/rabbitmq-erlang-client/src/amqp_client.erl index f5fa1ae..83905d0 100644 --- a/plugins-src/rabbitmq-erlang-client/src/amqp_client.erl +++ b/plugins-src/rabbitmq-erlang-client/src/amqp_client.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% @private diff --git a/plugins-src/rabbitmq-erlang-client/src/amqp_connection.erl b/plugins-src/rabbitmq-erlang-client/src/amqp_connection.erl index d6d044f..371b225 100644 --- a/plugins-src/rabbitmq-erlang-client/src/amqp_connection.erl +++ b/plugins-src/rabbitmq-erlang-client/src/amqp_connection.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% @type close_reason(Type) = {shutdown, amqp_reason(Type)}. diff --git a/plugins-src/rabbitmq-erlang-client/src/amqp_connection_sup.erl b/plugins-src/rabbitmq-erlang-client/src/amqp_connection_sup.erl index 5268ded..7bc8a2d 100644 --- a/plugins-src/rabbitmq-erlang-client/src/amqp_connection_sup.erl +++ b/plugins-src/rabbitmq-erlang-client/src/amqp_connection_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% @private diff --git a/plugins-src/rabbitmq-erlang-client/src/amqp_connection_type_sup.erl b/plugins-src/rabbitmq-erlang-client/src/amqp_connection_type_sup.erl index 41717c2..5802375 100644 --- a/plugins-src/rabbitmq-erlang-client/src/amqp_connection_type_sup.erl +++ b/plugins-src/rabbitmq-erlang-client/src/amqp_connection_type_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% @private diff --git a/plugins-src/rabbitmq-erlang-client/src/amqp_direct_connection.erl b/plugins-src/rabbitmq-erlang-client/src/amqp_direct_connection.erl index fae9be1..5cd7df7 100644 --- a/plugins-src/rabbitmq-erlang-client/src/amqp_direct_connection.erl +++ b/plugins-src/rabbitmq-erlang-client/src/amqp_direct_connection.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% @private @@ -74,6 +74,8 @@ {ok, State}; handle_message(closing_timeout, State = #state{closing_reason = Reason}) -> {stop, {closing_timeout, Reason}, State}; +handle_message({'DOWN', _MRef, process, _ConnSup, shutdown}, State) -> + {stop, {shutdown, node_down}, State}; handle_message({'DOWN', _MRef, process, _ConnSup, Reason}, State) -> {stop, {remote_node_down, Reason}, State}; handle_message(Msg, State) -> diff --git a/plugins-src/rabbitmq-erlang-client/src/amqp_direct_consumer.erl b/plugins-src/rabbitmq-erlang-client/src/amqp_direct_consumer.erl index 71995fb..34b1423 100644 --- a/plugins-src/rabbitmq-erlang-client/src/amqp_direct_consumer.erl +++ b/plugins-src/rabbitmq-erlang-client/src/amqp_direct_consumer.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2011-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2011-2015 Pivotal Software, Inc. All rights reserved. %% %% @doc This module is an implementation of the amqp_gen_consumer diff --git a/plugins-src/rabbitmq-erlang-client/src/amqp_gen_connection.erl b/plugins-src/rabbitmq-erlang-client/src/amqp_gen_connection.erl index 3cc64b7..55618ac 100644 --- a/plugins-src/rabbitmq-erlang-client/src/amqp_gen_connection.erl +++ b/plugins-src/rabbitmq-erlang-client/src/amqp_gen_connection.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% @private diff --git a/plugins-src/rabbitmq-erlang-client/src/amqp_gen_consumer.erl b/plugins-src/rabbitmq-erlang-client/src/amqp_gen_consumer.erl index 5d0953d..68637cc 100644 --- a/plugins-src/rabbitmq-erlang-client/src/amqp_gen_consumer.erl +++ b/plugins-src/rabbitmq-erlang-client/src/amqp_gen_consumer.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2011-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2011-2015 Pivotal Software, Inc. All rights reserved. %% %% @doc A behaviour module for implementing consumers for diff --git a/plugins-src/rabbitmq-erlang-client/src/amqp_main_reader.erl b/plugins-src/rabbitmq-erlang-client/src/amqp_main_reader.erl index 258f73c..b8e4ff9 100644 --- a/plugins-src/rabbitmq-erlang-client/src/amqp_main_reader.erl +++ b/plugins-src/rabbitmq-erlang-client/src/amqp_main_reader.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% @private diff --git a/plugins-src/rabbitmq-erlang-client/src/amqp_network_connection.erl b/plugins-src/rabbitmq-erlang-client/src/amqp_network_connection.erl index 9ca08bf..5edb44b 100644 --- a/plugins-src/rabbitmq-erlang-client/src/amqp_network_connection.erl +++ b/plugins-src/rabbitmq-erlang-client/src/amqp_network_connection.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% @private @@ -304,7 +304,7 @@ {<<"version">>, longstr, list_to_binary(Vsn)}, {<<"platform">>, longstr, <<"Erlang">>}, {<<"copyright">>, longstr, - <<"Copyright (c) 2007-2014 GoPivotal, Inc.">>}, + <<"Copyright (c) 2007-2015 Pivotal Software, Inc.">>}, {<<"information">>, longstr, <<"Licensed under the MPL. " "See http://www.rabbitmq.com/">>}, diff --git a/plugins-src/rabbitmq-erlang-client/src/amqp_rpc_client.erl b/plugins-src/rabbitmq-erlang-client/src/amqp_rpc_client.erl index 6f8a227..c5bed0d 100644 --- a/plugins-src/rabbitmq-erlang-client/src/amqp_rpc_client.erl +++ b/plugins-src/rabbitmq-erlang-client/src/amqp_rpc_client.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% @doc This module allows the simple execution of an asynchronous RPC over diff --git a/plugins-src/rabbitmq-erlang-client/src/amqp_rpc_server.erl b/plugins-src/rabbitmq-erlang-client/src/amqp_rpc_server.erl index 35e28a9..1452536 100644 --- a/plugins-src/rabbitmq-erlang-client/src/amqp_rpc_server.erl +++ b/plugins-src/rabbitmq-erlang-client/src/amqp_rpc_server.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% @doc This is a utility module that is used to expose an arbitrary function diff --git a/plugins-src/rabbitmq-erlang-client/src/amqp_selective_consumer.erl b/plugins-src/rabbitmq-erlang-client/src/amqp_selective_consumer.erl index a7bd906..dc916ac 100644 --- a/plugins-src/rabbitmq-erlang-client/src/amqp_selective_consumer.erl +++ b/plugins-src/rabbitmq-erlang-client/src/amqp_selective_consumer.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2011-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2011-2015 Pivotal Software, Inc. All rights reserved. %% %% @doc This module is an implementation of the amqp_gen_consumer diff --git a/plugins-src/rabbitmq-erlang-client/src/amqp_sup.erl b/plugins-src/rabbitmq-erlang-client/src/amqp_sup.erl index 984e9bb..9c928d5 100644 --- a/plugins-src/rabbitmq-erlang-client/src/amqp_sup.erl +++ b/plugins-src/rabbitmq-erlang-client/src/amqp_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% @private diff --git a/plugins-src/rabbitmq-erlang-client/src/amqp_uri.erl b/plugins-src/rabbitmq-erlang-client/src/amqp_uri.erl index 63609d9..04446b0 100644 --- a/plugins-src/rabbitmq-erlang-client/src/amqp_uri.erl +++ b/plugins-src/rabbitmq-erlang-client/src/amqp_uri.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(amqp_uri). diff --git a/plugins-src/rabbitmq-erlang-client/src/rabbit_routing_util.erl b/plugins-src/rabbitmq-erlang-client/src/rabbit_routing_util.erl index d64d04f..7daa728 100644 --- a/plugins-src/rabbitmq-erlang-client/src/rabbit_routing_util.erl +++ b/plugins-src/rabbitmq-erlang-client/src/rabbit_routing_util.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2013-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2013-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_routing_util). diff --git a/plugins-src/rabbitmq-erlang-client/test/Makefile b/plugins-src/rabbitmq-erlang-client/test/Makefile index 5b55b51..beef64c 100644 --- a/plugins-src/rabbitmq-erlang-client/test/Makefile +++ b/plugins-src/rabbitmq-erlang-client/test/Makefile @@ -11,7 +11,7 @@ # The Original Code is RabbitMQ. # # The Initial Developer of the Original Code is GoPivotal, Inc. -# Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +# Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. # TEST_SOURCES=$(wildcard *.erl) diff --git a/plugins-src/rabbitmq-erlang-client/test/amqp_client_SUITE.erl b/plugins-src/rabbitmq-erlang-client/test/amqp_client_SUITE.erl index 3512475..e0bef04 100644 --- a/plugins-src/rabbitmq-erlang-client/test/amqp_client_SUITE.erl +++ b/plugins-src/rabbitmq-erlang-client/test/amqp_client_SUITE.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(amqp_client_SUITE). diff --git a/plugins-src/rabbitmq-erlang-client/test/amqp_dbg.erl b/plugins-src/rabbitmq-erlang-client/test/amqp_dbg.erl index f6b5cb0..cb20555 100644 --- a/plugins-src/rabbitmq-erlang-client/test/amqp_dbg.erl +++ b/plugins-src/rabbitmq-erlang-client/test/amqp_dbg.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(amqp_dbg). diff --git a/plugins-src/rabbitmq-erlang-client/test/negative_test_util.erl b/plugins-src/rabbitmq-erlang-client/test/negative_test_util.erl index 96da8d3..a4f962c 100644 --- a/plugins-src/rabbitmq-erlang-client/test/negative_test_util.erl +++ b/plugins-src/rabbitmq-erlang-client/test/negative_test_util.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(negative_test_util). diff --git a/plugins-src/rabbitmq-erlang-client/test/test_util.erl b/plugins-src/rabbitmq-erlang-client/test/test_util.erl index 121a400..b674423 100644 --- a/plugins-src/rabbitmq-erlang-client/test/test_util.erl +++ b/plugins-src/rabbitmq-erlang-client/test/test_util.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2011-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2011-2015 Pivotal Software, Inc. All rights reserved. %% -module(test_util). diff --git a/plugins-src/rabbitmq-erlang-client/test.mk b/plugins-src/rabbitmq-erlang-client/test.mk index e36d21a..ae3057f 100644 --- a/plugins-src/rabbitmq-erlang-client/test.mk +++ b/plugins-src/rabbitmq-erlang-client/test.mk @@ -11,7 +11,7 @@ # The Original Code is RabbitMQ. # # The Initial Developer of the Original Code is GoPivotal, Inc. -# Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +# Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. # IS_SUCCESS:=egrep "(All .+ tests (successful|passed).|Test passed.)" diff --git a/plugins-src/rabbitmq-federation/include/rabbit_federation.hrl b/plugins-src/rabbitmq-federation/include/rabbit_federation.hrl index 66c8a8a..0995cfd 100644 --- a/plugins-src/rabbitmq-federation/include/rabbit_federation.hrl +++ b/plugins-src/rabbitmq-federation/include/rabbit_federation.hrl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Federation. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -record(upstream, {uris, @@ -25,7 +25,8 @@ trust_user_id, ack_mode, ha_policy, - name}). + name, + bind_nowait}). -record(upstream_params, {uri, diff --git a/plugins-src/rabbitmq-federation/src/rabbit_federation_app.erl b/plugins-src/rabbitmq-federation/src/rabbit_federation_app.erl index d4bdc29..119ef60 100644 --- a/plugins-src/rabbitmq-federation/src/rabbit_federation_app.erl +++ b/plugins-src/rabbitmq-federation/src/rabbit_federation_app.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Federation. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_federation_app). diff --git a/plugins-src/rabbitmq-federation/src/rabbit_federation_db.erl b/plugins-src/rabbitmq-federation/src/rabbit_federation_db.erl index 7faf3eb..d00f991 100644 --- a/plugins-src/rabbitmq-federation/src/rabbit_federation_db.erl +++ b/plugins-src/rabbitmq-federation/src/rabbit_federation_db.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Federation. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_federation_db). diff --git a/plugins-src/rabbitmq-federation/src/rabbit_federation_event.erl b/plugins-src/rabbitmq-federation/src/rabbit_federation_event.erl index cc868e3..677d5f2 100644 --- a/plugins-src/rabbitmq-federation/src/rabbit_federation_event.erl +++ b/plugins-src/rabbitmq-federation/src/rabbit_federation_event.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_federation_event). diff --git a/plugins-src/rabbitmq-federation/src/rabbit_federation_exchange.erl b/plugins-src/rabbitmq-federation/src/rabbit_federation_exchange.erl index 3293c09..fa6102c 100644 --- a/plugins-src/rabbitmq-federation/src/rabbit_federation_exchange.erl +++ b/plugins-src/rabbitmq-federation/src/rabbit_federation_exchange.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Federation. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% TODO rename this diff --git a/plugins-src/rabbitmq-federation/src/rabbit_federation_exchange_link.erl b/plugins-src/rabbitmq-federation/src/rabbit_federation_exchange_link.erl index 2730045..12f5316 100644 --- a/plugins-src/rabbitmq-federation/src/rabbit_federation_exchange_link.erl +++ b/plugins-src/rabbitmq-federation/src/rabbit_federation_exchange_link.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Federation. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_federation_exchange_link). @@ -274,24 +274,28 @@ bind_cmd(Type, #binding{key = Key, args = Args}, State = #state{internal_exchange = IntXNameBin, - upstream_params = UpstreamParams}) -> + upstream_params = UpstreamParams, + upstream = Upstream}) -> #upstream_params{x_or_q = X} = UpstreamParams, + #upstream{bind_nowait = Nowait} = Upstream, case update_binding(Args, State) of ignore -> ignore; - NewArgs -> bind_cmd0(Type, name(X), IntXNameBin, Key, NewArgs) + NewArgs -> bind_cmd0(Type, name(X), IntXNameBin, Key, NewArgs, Nowait) end. -bind_cmd0(bind, Source, Destination, RoutingKey, Arguments) -> +bind_cmd0(bind, Source, Destination, RoutingKey, Arguments, Nowait) -> #'exchange.bind'{source = Source, destination = Destination, routing_key = RoutingKey, - arguments = Arguments}; - -bind_cmd0(unbind, Source, Destination, RoutingKey, Arguments) -> + arguments = Arguments, + nowait = Nowait}; + +bind_cmd0(unbind, Source, Destination, RoutingKey, Arguments, Nowait) -> #'exchange.unbind'{source = Source, destination = Destination, routing_key = RoutingKey, - arguments = Arguments}. + arguments = Arguments, + nowait = Nowait}. %% This function adds information about the current node to the %% binding arguments, or returns 'ignore' if it determines the binding diff --git a/plugins-src/rabbitmq-federation/src/rabbit_federation_exchange_link_sup_sup.erl b/plugins-src/rabbitmq-federation/src/rabbit_federation_exchange_link_sup_sup.erl index 8aeb5b7..529edea 100644 --- a/plugins-src/rabbitmq-federation/src/rabbit_federation_exchange_link_sup_sup.erl +++ b/plugins-src/rabbitmq-federation/src/rabbit_federation_exchange_link_sup_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Federation. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_federation_exchange_link_sup_sup). diff --git a/plugins-src/rabbitmq-federation/src/rabbit_federation_link_sup.erl b/plugins-src/rabbitmq-federation/src/rabbit_federation_link_sup.erl index dd5f9ce..2999a18 100644 --- a/plugins-src/rabbitmq-federation/src/rabbit_federation_link_sup.erl +++ b/plugins-src/rabbitmq-federation/src/rabbit_federation_link_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Federation. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_federation_link_sup). diff --git a/plugins-src/rabbitmq-federation/src/rabbit_federation_link_util.erl b/plugins-src/rabbitmq-federation/src/rabbit_federation_link_util.erl index d88f09e..757331f 100644 --- a/plugins-src/rabbitmq-federation/src/rabbit_federation_link_util.erl +++ b/plugins-src/rabbitmq-federation/src/rabbit_federation_link_util.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Federation. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_federation_link_util). diff --git a/plugins-src/rabbitmq-federation/src/rabbit_federation_parameters.erl b/plugins-src/rabbitmq-federation/src/rabbit_federation_parameters.erl index 59ba014..c05f4c0 100644 --- a/plugins-src/rabbitmq-federation/src/rabbit_federation_parameters.erl +++ b/plugins-src/rabbitmq-federation/src/rabbit_federation_parameters.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_federation_parameters). @@ -91,7 +91,8 @@ {<<"trust-user-id">>, fun rabbit_parameter_validation:boolean/2, optional}, {<<"ack-mode">>, rabbit_parameter_validation:enum( ['no-ack', 'on-publish', 'on-confirm']), optional}, - {<<"ha-policy">>, fun rabbit_parameter_validation:binary/2, optional}]. + {<<"ha-policy">>, fun rabbit_parameter_validation:binary/2, optional}, + {<<"bind-nowait">>, fun rabbit_parameter_validation:boolean/2, optional}]. validate_uri(Name, Term) when is_binary(Term) -> case rabbit_parameter_validation:binary(Name, Term) of diff --git a/plugins-src/rabbitmq-federation/src/rabbit_federation_queue.erl b/plugins-src/rabbitmq-federation/src/rabbit_federation_queue.erl index 3a5d82f..49c4f40 100644 --- a/plugins-src/rabbitmq-federation/src/rabbit_federation_queue.erl +++ b/plugins-src/rabbitmq-federation/src/rabbit_federation_queue.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Federation. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_federation_queue). diff --git a/plugins-src/rabbitmq-federation/src/rabbit_federation_queue_link.erl b/plugins-src/rabbitmq-federation/src/rabbit_federation_queue_link.erl index 2daaee2..4dd7810 100644 --- a/plugins-src/rabbitmq-federation/src/rabbit_federation_queue_link.erl +++ b/plugins-src/rabbitmq-federation/src/rabbit_federation_queue_link.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Federation. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_federation_queue_link). diff --git a/plugins-src/rabbitmq-federation/src/rabbit_federation_queue_link_sup_sup.erl b/plugins-src/rabbitmq-federation/src/rabbit_federation_queue_link_sup_sup.erl index e5d2628..9c6a703 100644 --- a/plugins-src/rabbitmq-federation/src/rabbit_federation_queue_link_sup_sup.erl +++ b/plugins-src/rabbitmq-federation/src/rabbit_federation_queue_link_sup_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Federation. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_federation_queue_link_sup_sup). diff --git a/plugins-src/rabbitmq-federation/src/rabbit_federation_status.erl b/plugins-src/rabbitmq-federation/src/rabbit_federation_status.erl index 7fd7e7e..59dc79e 100644 --- a/plugins-src/rabbitmq-federation/src/rabbit_federation_status.erl +++ b/plugins-src/rabbitmq-federation/src/rabbit_federation_status.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Federation. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_federation_status). diff --git a/plugins-src/rabbitmq-federation/src/rabbit_federation_sup.erl b/plugins-src/rabbitmq-federation/src/rabbit_federation_sup.erl index c30281c..52a837d 100644 --- a/plugins-src/rabbitmq-federation/src/rabbit_federation_sup.erl +++ b/plugins-src/rabbitmq-federation/src/rabbit_federation_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Federation. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_federation_sup). diff --git a/plugins-src/rabbitmq-federation/src/rabbit_federation_upstream.erl b/plugins-src/rabbitmq-federation/src/rabbit_federation_upstream.erl index 168fce0..398dbcf 100644 --- a/plugins-src/rabbitmq-federation/src/rabbit_federation_upstream.erl +++ b/plugins-src/rabbitmq-federation/src/rabbit_federation_upstream.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Federation. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_federation_upstream). @@ -131,7 +131,8 @@ binary_to_list( bget('ack-mode', US, U, <<"on-confirm">>))), ha_policy = bget('ha-policy', US, U, none), - name = Name}. + name = Name, + bind_nowait = bget('bind-nowait', US, U, false)}. %%---------------------------------------------------------------------------- diff --git a/plugins-src/rabbitmq-federation/src/rabbit_federation_upstream_exchange.erl b/plugins-src/rabbitmq-federation/src/rabbit_federation_upstream_exchange.erl index 3fd8a05..920bc9f 100644 --- a/plugins-src/rabbitmq-federation/src/rabbit_federation_upstream_exchange.erl +++ b/plugins-src/rabbitmq-federation/src/rabbit_federation_upstream_exchange.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Federation. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_federation_upstream_exchange). diff --git a/plugins-src/rabbitmq-federation/src/rabbit_federation_util.erl b/plugins-src/rabbitmq-federation/src/rabbit_federation_util.erl index b6a1cfd..33e903e 100644 --- a/plugins-src/rabbitmq-federation/src/rabbit_federation_util.erl +++ b/plugins-src/rabbitmq-federation/src/rabbit_federation_util.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Federation. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_federation_util). diff --git a/plugins-src/rabbitmq-federation/test/src/rabbit_federation_exchange_test.erl b/plugins-src/rabbitmq-federation/test/src/rabbit_federation_exchange_test.erl index 09eda11..cce16f8 100644 --- a/plugins-src/rabbitmq-federation/test/src/rabbit_federation_exchange_test.erl +++ b/plugins-src/rabbitmq-federation/test/src/rabbit_federation_exchange_test.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Federation. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_federation_exchange_test). diff --git a/plugins-src/rabbitmq-federation/test/src/rabbit_federation_queue_test.erl b/plugins-src/rabbitmq-federation/test/src/rabbit_federation_queue_test.erl index f67a3de..d58c0d6 100644 --- a/plugins-src/rabbitmq-federation/test/src/rabbit_federation_queue_test.erl +++ b/plugins-src/rabbitmq-federation/test/src/rabbit_federation_queue_test.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Federation. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_federation_queue_test). diff --git a/plugins-src/rabbitmq-federation/test/src/rabbit_federation_test_util.erl b/plugins-src/rabbitmq-federation/test/src/rabbit_federation_test_util.erl index 87a584e..d70042e 100644 --- a/plugins-src/rabbitmq-federation/test/src/rabbit_federation_test_util.erl +++ b/plugins-src/rabbitmq-federation/test/src/rabbit_federation_test_util.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Federation. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_federation_test_util). diff --git a/plugins-src/rabbitmq-federation/test/src/rabbit_federation_unit_test.erl b/plugins-src/rabbitmq-federation/test/src/rabbit_federation_unit_test.erl index 3a1cf8b..76d23b8 100644 --- a/plugins-src/rabbitmq-federation/test/src/rabbit_federation_unit_test.erl +++ b/plugins-src/rabbitmq-federation/test/src/rabbit_federation_unit_test.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Federation. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_federation_unit_test). diff --git a/plugins-src/rabbitmq-federation-management/src/rabbit_federation_mgmt.erl b/plugins-src/rabbitmq-federation-management/src/rabbit_federation_mgmt.erl index 818f3a9..10dde01 100644 --- a/plugins-src/rabbitmq-federation-management/src/rabbit_federation_mgmt.erl +++ b/plugins-src/rabbitmq-federation-management/src/rabbit_federation_mgmt.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_federation_mgmt). diff --git a/plugins-src/rabbitmq-management/LICENSE-MPL-RabbitMQ b/plugins-src/rabbitmq-management/LICENSE-MPL-RabbitMQ index b412190..0339c53 100644 --- a/plugins-src/rabbitmq-management/LICENSE-MPL-RabbitMQ +++ b/plugins-src/rabbitmq-management/LICENSE-MPL-RabbitMQ @@ -447,7 +447,7 @@ The Original Code is RabbitMQ Management Plugin. The Initial Developer of the Original Code is GoPivotal, Inc. - Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved.'' + Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved.'' [NOTE: The text of this Exhibit A may differ slightly from the text of the notices in the Source Code files of the Original Code. You should diff --git a/plugins-src/rabbitmq-management/bin/rabbitmqadmin b/plugins-src/rabbitmq-management/bin/rabbitmqadmin index 344fdce..f8f2da5 100755 --- a/plugins-src/rabbitmq-management/bin/rabbitmqadmin +++ b/plugins-src/rabbitmq-management/bin/rabbitmqadmin @@ -13,7 +13,7 @@ # The Original Code is RabbitMQ Management Plugin. # # The Initial Developer of the Original Code is GoPivotal, Inc. -# Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +# Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. import sys if sys.version_info[0] < 2 or (sys.version_info[0] == 2 and sys.version_info[1] < 6): diff --git a/plugins-src/rabbitmq-management/include/rabbit_mgmt.hrl b/plugins-src/rabbitmq-management/include/rabbit_mgmt.hrl index d9f342e..43cc67d 100644 --- a/plugins-src/rabbitmq-management/include/rabbit_mgmt.hrl +++ b/plugins-src/rabbitmq-management/include/rabbit_mgmt.hrl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Console. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -record(context, {user, password = none}). diff --git a/plugins-src/rabbitmq-management/priv/www/js/tmpl/partition.ejs b/plugins-src/rabbitmq-management/priv/www/js/tmpl/partition.ejs index 3701aa7..bc22fe2 100644 --- a/plugins-src/rabbitmq-management/priv/www/js/tmpl/partition.ejs +++ b/plugins-src/rabbitmq-management/priv/www/js/tmpl/partition.ejs @@ -12,7 +12,10 @@ %>

Network partition detected

- Mnesia reports that this RabbitMQ cluster has experienced a network partition. This is a dangerous situation. RabbitMQ clusters should not be installed on networks which can experience partitions. + Mnesia reports that this RabbitMQ cluster has experienced a + network partition. There is a risk of losing data. Please read + RabbitMQ + documentation about network partitions and the possible solutions.

The nature of the partition is as follows: diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_app.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_app.erl index 082eb96..b5f4b6b 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_app.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_app.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_app). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_db.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_db.erl index ad79368..e7cb753 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_db.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_db.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_db). @@ -744,9 +744,12 @@ end. append_sample(Key, Val, NewMS, OldStats, Id, Agg, State) when is_number(Val) -> - record_sample( - Id, {Key, Val - pget(Key, OldStats, 0), NewMS, State}, Agg, State); - + OldVal = case pget(Key, OldStats, 0) of + N when is_number(N) -> N; + _ -> 0 + end, + record_sample(Id, {Key, Val - OldVal, NewMS, State}, Agg, State), + ok; append_sample(_Key, _Value, _NewMS, _OldStats, _Id, _Agg, _State) -> ok. diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_dispatcher.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_dispatcher.erl index e792583..e42635e 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_dispatcher.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_dispatcher.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_dispatcher). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_extension.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_extension.erl index 5ecc38d..b558c40 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_extension.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_extension.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2011-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2011-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_extension). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_format.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_format.erl index 2613dcc..b16d131 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_format.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_format.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_format). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_load_definitions.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_load_definitions.erl index 95fadfe..d12f545 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_load_definitions.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_load_definitions.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_load_definitions). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_reset_handler.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_reset_handler.erl index 9f62d49..e16351f 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_reset_handler.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_reset_handler.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Console. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2013 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% %% When management extensions are enabled and/or disabled at runtime, the diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_sup.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_sup.erl index 008dd58..992ff72 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_sup.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Console. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2011-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2011-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_sup). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_sup_sup.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_sup_sup.erl index d83fb3b..6758a5d 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_sup_sup.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_sup_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Console. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2011-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2011-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_sup_sup). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_util.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_util.erl index 006d54d..2a15101 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_util.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_util.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_util). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_aliveness_test.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_aliveness_test.erl index 445eee5..fec6196 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_aliveness_test.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_aliveness_test.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_aliveness_test). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_binding.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_binding.erl index d794558..16e42ae 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_binding.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_binding.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_binding). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_bindings.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_bindings.erl index cced05c..4f80778 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_bindings.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_bindings.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_bindings). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_channel.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_channel.erl index 67e584f..6410433 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_channel.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_channel.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_channel). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_channels.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_channels.erl index 0274c8d..6675fa2 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_channels.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_channels.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_channels). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_cluster_name.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_cluster_name.erl index e3d2c43..f741821 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_cluster_name.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_cluster_name.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_cluster_name). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_connection.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_connection.erl index 7f918b1..523bec2 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_connection.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_connection.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_connection). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_connection_channels.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_connection_channels.erl index c15b977..9becc91 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_connection_channels.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_connection_channels.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_connection_channels). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_connections.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_connections.erl index 85689eb..1263d91 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_connections.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_connections.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_connections). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_consumers.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_consumers.erl index d531fc4..3d791d0 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_consumers.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_consumers.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. -module(rabbit_mgmt_wm_consumers). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_definitions.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_definitions.erl index 6c633d3..a33d6a1 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_definitions.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_definitions.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_definitions). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_exchange.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_exchange.erl index c953337..374280a 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_exchange.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_exchange.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_exchange). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_exchange_publish.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_exchange_publish.erl index 1b941d9..467c055 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_exchange_publish.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_exchange_publish.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2011-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2011-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_exchange_publish). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_exchanges.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_exchanges.erl index f5cdf7d..f1df46a 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_exchanges.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_exchanges.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_exchanges). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_extensions.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_extensions.erl index 4cf3369..b38bf1d 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_extensions.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_extensions.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2011-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2011-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_extensions). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_node.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_node.erl index 941c5b5..646d183 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_node.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_node.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Console. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_node). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_nodes.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_nodes.erl index 79ac36d..fb86e1e 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_nodes.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_nodes.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Console. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_nodes). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_overview.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_overview.erl index 6cb9dd2..486016c 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_overview.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_overview.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_overview). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_parameter.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_parameter.erl index b266542..5af5d38 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_parameter.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_parameter.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_parameter). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_parameters.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_parameters.erl index c2f1e1b..0664baf 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_parameters.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_parameters.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_parameters). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_permission.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_permission.erl index 55eca61..ec1046b 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_permission.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_permission.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_permission). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_permissions.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_permissions.erl index 456bbfb..52f4771 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_permissions.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_permissions.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_permissions). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_permissions_user.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_permissions_user.erl index 60f0a89..df19045 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_permissions_user.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_permissions_user.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_permissions_user). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_permissions_vhost.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_permissions_vhost.erl index 390d6e0..062a902 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_permissions_vhost.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_permissions_vhost.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_permissions_vhost). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_policies.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_policies.erl index 74c9ee2..1236bcd 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_policies.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_policies.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_policies). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_policy.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_policy.erl index b22c369..fa9e1aa 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_policy.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_policy.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_policy). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_queue.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_queue.erl index e3c6f70..fb7e8ab 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_queue.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_queue.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_queue). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_queue_get.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_queue_get.erl index 1602457..8998bfc 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_queue_get.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_queue_get.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2011-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2011-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_queue_get). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_queue_purge.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_queue_purge.erl index 0d35113..42aeb95 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_queue_purge.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_queue_purge.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_queue_purge). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_queues.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_queues.erl index 73126ce..51265c7 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_queues.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_queues.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_queues). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_user.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_user.erl index a9aa195..b8b6529 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_user.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_user.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_user). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_users.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_users.erl index 013561b..7bf07bf 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_users.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_users.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_users). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_vhost.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_vhost.erl index 7907636..0908d90 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_vhost.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_vhost.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_vhost). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_vhosts.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_vhosts.erl index 54bf9ff..961b6f7 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_vhosts.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_vhosts.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_vhosts). diff --git a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_whoami.erl b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_whoami.erl index 0d75b04..564b394 100644 --- a/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_whoami.erl +++ b/plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_whoami.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Plugin. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_wm_whoami). diff --git a/plugins-src/rabbitmq-management/test/src/rabbit_mgmt_test_db.erl b/plugins-src/rabbitmq-management/test/src/rabbit_mgmt_test_db.erl index 6c4011c..528ec33 100644 --- a/plugins-src/rabbitmq-management/test/src/rabbit_mgmt_test_db.erl +++ b/plugins-src/rabbitmq-management/test/src/rabbit_mgmt_test_db.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Console. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_test_db). diff --git a/plugins-src/rabbitmq-management/test/src/rabbit_mgmt_test_http.erl b/plugins-src/rabbitmq-management/test/src/rabbit_mgmt_test_http.erl index c768b65..f56a330 100644 --- a/plugins-src/rabbitmq-management/test/src/rabbit_mgmt_test_http.erl +++ b/plugins-src/rabbitmq-management/test/src/rabbit_mgmt_test_http.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Console. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_test_http). diff --git a/plugins-src/rabbitmq-management/test/src/rabbit_mgmt_test_unit.erl b/plugins-src/rabbitmq-management/test/src/rabbit_mgmt_test_unit.erl index a3ecc80..de71872 100644 --- a/plugins-src/rabbitmq-management/test/src/rabbit_mgmt_test_unit.erl +++ b/plugins-src/rabbitmq-management/test/src/rabbit_mgmt_test_unit.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Console. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_test_unit). diff --git a/plugins-src/rabbitmq-management-agent/src/rabbit_mgmt_agent_app.erl b/plugins-src/rabbitmq-management-agent/src/rabbit_mgmt_agent_app.erl index f89a7a2..6220ac6 100644 --- a/plugins-src/rabbitmq-management-agent/src/rabbit_mgmt_agent_app.erl +++ b/plugins-src/rabbitmq-management-agent/src/rabbit_mgmt_agent_app.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Console. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_agent_app). diff --git a/plugins-src/rabbitmq-management-agent/src/rabbit_mgmt_agent_sup.erl b/plugins-src/rabbitmq-management-agent/src/rabbit_mgmt_agent_sup.erl index 647b99f..cd0635f 100644 --- a/plugins-src/rabbitmq-management-agent/src/rabbit_mgmt_agent_sup.erl +++ b/plugins-src/rabbitmq-management-agent/src/rabbit_mgmt_agent_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Console. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_agent_sup). diff --git a/plugins-src/rabbitmq-management-agent/src/rabbit_mgmt_db_handler.erl b/plugins-src/rabbitmq-management-agent/src/rabbit_mgmt_db_handler.erl index 2ceb458..5bd9bc0 100644 --- a/plugins-src/rabbitmq-management-agent/src/rabbit_mgmt_db_handler.erl +++ b/plugins-src/rabbitmq-management-agent/src/rabbit_mgmt_db_handler.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Console. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_db_handler). @@ -42,27 +42,38 @@ gc() -> erlang:garbage_collect(whereis(rabbit_event)). +%% some people have reasons to only run with the agent enabled: +%% make it possible for them to configure key management app +%% settings such as rates_mode. +get_management_env(Key) -> + rabbit_misc:get_env( + rabbitmq_management, Key, + rabbit_misc:get_env(rabbitmq_management_agent, Key, undefined)). + rates_mode() -> - case application:get_env(rabbitmq_management, rates_mode) of - {ok, Mode} -> Mode; - _ -> basic + case get_management_env(rates_mode) of + undefined -> basic; + Mode -> Mode + end. + +handle_force_fine_statistics() -> + case get_management_env(force_fine_statistics) of + undefined -> + ok; + X -> + rabbit_log:warning( + "force_fine_statistics set to ~p; ignored.~n" + "Replaced by {rates_mode, none} in the rabbitmq_management " + "application.~n", [X]) end. %%---------------------------------------------------------------------------- ensure_statistics_enabled() -> ForceStats = rates_mode() =/= none, - case application:get_env(rabbitmq_management_agent, - force_fine_statistics) of - {ok, X} -> - rabbit_log:warning( - "force_fine_statistics set to ~p; ignored.~n" - "Replaced by {rates_mode, none} in the rabbitmq_management " - "application.~n", [X]); - undefined -> - ok - end, + handle_force_fine_statistics(), {ok, StatsLevel} = application:get_env(rabbit, collect_statistics), + rabbit_log:info("Management plugin: using rates mode '~p'~n", [rates_mode()]), case {ForceStats, StatsLevel} of {true, fine} -> ok; diff --git a/plugins-src/rabbitmq-management-agent/src/rabbit_mgmt_external_stats.erl b/plugins-src/rabbitmq-management-agent/src/rabbit_mgmt_external_stats.erl index 7172e03..62f783b 100644 --- a/plugins-src/rabbitmq-management-agent/src/rabbit_mgmt_external_stats.erl +++ b/plugins-src/rabbitmq-management-agent/src/rabbit_mgmt_external_stats.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Management Console. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_external_stats). diff --git a/plugins-src/rabbitmq-mqtt/include/rabbit_mqtt.hrl b/plugins-src/rabbitmq-mqtt/include/rabbit_mqtt.hrl index 0bbc7f4..b620a31 100644 --- a/plugins-src/rabbitmq-mqtt/include/rabbit_mqtt.hrl +++ b/plugins-src/rabbitmq-mqtt/include/rabbit_mqtt.hrl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -define(CLIENT_ID_MAXLEN, 23). diff --git a/plugins-src/rabbitmq-mqtt/include/rabbit_mqtt_frame.hrl b/plugins-src/rabbitmq-mqtt/include/rabbit_mqtt_frame.hrl index 87f24d5..968f986 100644 --- a/plugins-src/rabbitmq-mqtt/include/rabbit_mqtt_frame.hrl +++ b/plugins-src/rabbitmq-mqtt/include/rabbit_mqtt_frame.hrl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -define(PROTOCOL_NAMES, [{3, "MQIsdp"}, {4, "MQTT"}]). diff --git a/plugins-src/rabbitmq-mqtt/package.mk b/plugins-src/rabbitmq-mqtt/package.mk index 14af468..c5d5bcc 100644 --- a/plugins-src/rabbitmq-mqtt/package.mk +++ b/plugins-src/rabbitmq-mqtt/package.mk @@ -10,8 +10,8 @@ rm -rf $(PACKAGE_DIR)/test/certs mkdir $(PACKAGE_DIR)/test/certs mkdir -p $(PACKAGE_DIR)/test/ebin - sed -e "s|%%CERTS_DIR%%|$(abspath $(PACKAGE_DIR))/test/certs|g" < $(PACKAGE_DIR)/test/src/test.config > $(PACKAGE_DIR)/test/ebin/test.config - make -C $(PACKAGE_DIR)/../rabbitmq-test/certs all PASSWORD=bunnychow DIR=$(abspath $(PACKAGE_DIR))/test/certs + sed -E -e "s|%%CERTS_DIR%%|$(abspath $(PACKAGE_DIR))/test/certs|g" < $(PACKAGE_DIR)/test/src/test.config > $(PACKAGE_DIR)/test/ebin/test.config + $(MAKE) -C $(PACKAGE_DIR)/../rabbitmq-test/certs all PASSWORD=bunnychow DIR=$(abspath $(PACKAGE_DIR))/test/certs $(PACKAGE_DIR)+clean:: rm -rf $(PACKAGE_DIR)/test/certs diff --git a/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt.erl b/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt.erl index 25e191a..92c2916 100644 --- a/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt.erl +++ b/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mqtt). diff --git a/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_collector.erl b/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_collector.erl index 26009ee..52a3da9 100644 --- a/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_collector.erl +++ b/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_collector.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mqtt_collector). diff --git a/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_connection_sup.erl b/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_connection_sup.erl index dd722c0..fd083a4 100644 --- a/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_connection_sup.erl +++ b/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_connection_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mqtt_connection_sup). diff --git a/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_frame.erl b/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_frame.erl index 39172c7..6282411 100644 --- a/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_frame.erl +++ b/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_frame.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mqtt_frame). diff --git a/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_processor.erl b/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_processor.erl index 9312f75..8ab736c 100644 --- a/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_processor.erl +++ b/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_processor.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mqtt_processor). diff --git a/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_reader.erl b/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_reader.erl index b7c569a..30cf032 100644 --- a/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_reader.erl +++ b/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_reader.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mqtt_reader). diff --git a/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_sup.erl b/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_sup.erl index 1bb23df..38edcf9 100644 --- a/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_sup.erl +++ b/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mqtt_sup). @@ -32,7 +32,7 @@ = case SslListeners0 of [] -> {none, []}; _ -> {rabbit_networking:ensure_ssl(), - case rabbit_networking:poodle_check('STOMP') of + case rabbit_networking:poodle_check('MQTT') of ok -> SslListeners0; danger -> [] end} diff --git a/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_util.erl b/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_util.erl index c675ebd..9c1787a 100644 --- a/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_util.erl +++ b/plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_util.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mqtt_util). diff --git a/plugins-src/rabbitmq-mqtt/test/Makefile b/plugins-src/rabbitmq-mqtt/test/Makefile index 5c3eb2d..190e740 100644 --- a/plugins-src/rabbitmq-mqtt/test/Makefile +++ b/plugins-src/rabbitmq-mqtt/test/Makefile @@ -39,5 +39,4 @@ .PHONY: build_java_amqp build_java_amqp: $(CHECKOUT_DIR) - make -C $(JAVA_AMQP_DIR) jar - + $(MAKE) -C $(JAVA_AMQP_DIR) jar diff --git a/plugins-src/rabbitmq-mqtt/test/src/com/rabbitmq/mqtt/test/MqttTest.java b/plugins-src/rabbitmq-mqtt/test/src/com/rabbitmq/mqtt/test/MqttTest.java index 0453c91..b5a4913 100644 --- a/plugins-src/rabbitmq-mqtt/test/src/com/rabbitmq/mqtt/test/MqttTest.java +++ b/plugins-src/rabbitmq-mqtt/test/src/com/rabbitmq/mqtt/test/MqttTest.java @@ -11,7 +11,7 @@ // The Original Code is RabbitMQ. // // The Initial Developer of the Original Code is GoPivotal, Inc. -// Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +// Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. // package com.rabbitmq.mqtt.test; @@ -40,6 +40,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.concurrent.TimeoutException; /*** * MQTT v3.1 tests @@ -110,7 +111,7 @@ } catch (Exception _) {} } - private void setUpAmqp() throws IOException { + private void setUpAmqp() throws IOException, TimeoutException { connectionFactory = new ConnectionFactory(); connectionFactory.setHost(host); conn = connectionFactory.newConnection(); @@ -377,7 +378,7 @@ } } - public void testInteropM2A() throws MqttException, IOException, InterruptedException { + public void testInteropM2A() throws MqttException, IOException, InterruptedException, TimeoutException { setUpAmqp(); String queue = ch.queueDeclare().getQueue(); ch.queueBind(queue, "amq.topic", topic); @@ -393,7 +394,7 @@ tearDownAmqp(); } - public void testInteropA2M() throws MqttException, IOException, InterruptedException { + public void testInteropA2M() throws MqttException, IOException, InterruptedException, TimeoutException { client.connect(conOpt); client.setCallback(this); client.subscribe(topic, 1); diff --git a/plugins-src/rabbitmq-mqtt/test/src/com/rabbitmq/mqtt/test/tls/MqttSSLTest.java b/plugins-src/rabbitmq-mqtt/test/src/com/rabbitmq/mqtt/test/tls/MqttSSLTest.java index f209d5e..f89d963 100644 --- a/plugins-src/rabbitmq-mqtt/test/src/com/rabbitmq/mqtt/test/tls/MqttSSLTest.java +++ b/plugins-src/rabbitmq-mqtt/test/src/com/rabbitmq/mqtt/test/tls/MqttSSLTest.java @@ -11,7 +11,7 @@ // The Original Code is RabbitMQ. // // The Initial Developer of the Original Code is GoPivotal, Inc. -// Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +// Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. // package com.rabbitmq.mqtt.test.tls; diff --git a/plugins-src/rabbitmq-mqtt/test/test.sh b/plugins-src/rabbitmq-mqtt/test/test.sh index 313aeb5..ae60a49 100755 --- a/plugins-src/rabbitmq-mqtt/test/test.sh +++ b/plugins-src/rabbitmq-mqtt/test/test.sh @@ -1,3 +1,3 @@ #!/bin/sh -make -C `dirname $0` build_java_amqp -make -C `dirname $0` test +$MAKE -C `dirname $0` build_java_amqp +$MAKE -C `dirname $0` test diff --git a/plugins-src/rabbitmq-shovel/include/rabbit_shovel.hrl b/plugins-src/rabbitmq-shovel/include/rabbit_shovel.hrl index b0f0aae..5168c8f 100644 --- a/plugins-src/rabbitmq-shovel/include/rabbit_shovel.hrl +++ b/plugins-src/rabbitmq-shovel/include/rabbit_shovel.hrl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -record(endpoint, diff --git a/plugins-src/rabbitmq-shovel/src/rabbit_shovel.erl b/plugins-src/rabbitmq-shovel/src/rabbit_shovel.erl index e416787..c945321 100644 --- a/plugins-src/rabbitmq-shovel/src/rabbit_shovel.erl +++ b/plugins-src/rabbitmq-shovel/src/rabbit_shovel.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_shovel). diff --git a/plugins-src/rabbitmq-shovel/src/rabbit_shovel_config.erl b/plugins-src/rabbitmq-shovel/src/rabbit_shovel_config.erl index a4e0ebc..a20b73b 100644 --- a/plugins-src/rabbitmq-shovel/src/rabbit_shovel_config.erl +++ b/plugins-src/rabbitmq-shovel/src/rabbit_shovel_config.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_shovel_config). diff --git a/plugins-src/rabbitmq-shovel/src/rabbit_shovel_dyn_worker_sup.erl b/plugins-src/rabbitmq-shovel/src/rabbit_shovel_dyn_worker_sup.erl index d5d5268..0e5991d 100644 --- a/plugins-src/rabbitmq-shovel/src/rabbit_shovel_dyn_worker_sup.erl +++ b/plugins-src/rabbitmq-shovel/src/rabbit_shovel_dyn_worker_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_shovel_dyn_worker_sup). diff --git a/plugins-src/rabbitmq-shovel/src/rabbit_shovel_dyn_worker_sup_sup.erl b/plugins-src/rabbitmq-shovel/src/rabbit_shovel_dyn_worker_sup_sup.erl index 9be7fd8..38bbd50 100644 --- a/plugins-src/rabbitmq-shovel/src/rabbit_shovel_dyn_worker_sup_sup.erl +++ b/plugins-src/rabbitmq-shovel/src/rabbit_shovel_dyn_worker_sup_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_shovel_dyn_worker_sup_sup). diff --git a/plugins-src/rabbitmq-shovel/src/rabbit_shovel_parameters.erl b/plugins-src/rabbitmq-shovel/src/rabbit_shovel_parameters.erl index fbd3d77..49bbcac 100644 --- a/plugins-src/rabbitmq-shovel/src/rabbit_shovel_parameters.erl +++ b/plugins-src/rabbitmq-shovel/src/rabbit_shovel_parameters.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_shovel_parameters). diff --git a/plugins-src/rabbitmq-shovel/src/rabbit_shovel_status.erl b/plugins-src/rabbitmq-shovel/src/rabbit_shovel_status.erl index f30dbc4..37d738e 100644 --- a/plugins-src/rabbitmq-shovel/src/rabbit_shovel_status.erl +++ b/plugins-src/rabbitmq-shovel/src/rabbit_shovel_status.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_shovel_status). diff --git a/plugins-src/rabbitmq-shovel/src/rabbit_shovel_sup.erl b/plugins-src/rabbitmq-shovel/src/rabbit_shovel_sup.erl index 488cef2..b0bce9d 100644 --- a/plugins-src/rabbitmq-shovel/src/rabbit_shovel_sup.erl +++ b/plugins-src/rabbitmq-shovel/src/rabbit_shovel_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_shovel_sup). diff --git a/plugins-src/rabbitmq-shovel/src/rabbit_shovel_util.erl b/plugins-src/rabbitmq-shovel/src/rabbit_shovel_util.erl index 8aa3636..a3b0f9c 100644 --- a/plugins-src/rabbitmq-shovel/src/rabbit_shovel_util.erl +++ b/plugins-src/rabbitmq-shovel/src/rabbit_shovel_util.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_shovel_util). diff --git a/plugins-src/rabbitmq-shovel/src/rabbit_shovel_worker.erl b/plugins-src/rabbitmq-shovel/src/rabbit_shovel_worker.erl index edad5e7..e5a8f63 100644 --- a/plugins-src/rabbitmq-shovel/src/rabbit_shovel_worker.erl +++ b/plugins-src/rabbitmq-shovel/src/rabbit_shovel_worker.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_shovel_worker). diff --git a/plugins-src/rabbitmq-shovel/src/rabbit_shovel_worker_sup.erl b/plugins-src/rabbitmq-shovel/src/rabbit_shovel_worker_sup.erl index 3528f9b..1705d5f 100644 --- a/plugins-src/rabbitmq-shovel/src/rabbit_shovel_worker_sup.erl +++ b/plugins-src/rabbitmq-shovel/src/rabbit_shovel_worker_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_shovel_worker_sup). diff --git a/plugins-src/rabbitmq-shovel/test/src/rabbit_shovel_test.erl b/plugins-src/rabbitmq-shovel/test/src/rabbit_shovel_test.erl index cdc7bae..6619112 100644 --- a/plugins-src/rabbitmq-shovel/test/src/rabbit_shovel_test.erl +++ b/plugins-src/rabbitmq-shovel/test/src/rabbit_shovel_test.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_shovel_test). diff --git a/plugins-src/rabbitmq-shovel/test/src/rabbit_shovel_test_all.erl b/plugins-src/rabbitmq-shovel/test/src/rabbit_shovel_test_all.erl index 74e7e96..2269ea8 100644 --- a/plugins-src/rabbitmq-shovel/test/src/rabbit_shovel_test_all.erl +++ b/plugins-src/rabbitmq-shovel/test/src/rabbit_shovel_test_all.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_shovel_test_all). diff --git a/plugins-src/rabbitmq-shovel/test/src/rabbit_shovel_test_dyn.erl b/plugins-src/rabbitmq-shovel/test/src/rabbit_shovel_test_dyn.erl index 9f65a37..b3c74d8 100644 --- a/plugins-src/rabbitmq-shovel/test/src/rabbit_shovel_test_dyn.erl +++ b/plugins-src/rabbitmq-shovel/test/src/rabbit_shovel_test_dyn.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Federation. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_shovel_test_dyn). diff --git a/plugins-src/rabbitmq-stomp/README.md b/plugins-src/rabbitmq-stomp/README.md index df7b890..782d563 100644 --- a/plugins-src/rabbitmq-stomp/README.md +++ b/plugins-src/rabbitmq-stomp/README.md @@ -5,9 +5,10 @@ rabbitmq-plugins enable rabbitmq_stomp -Binaries for previous versions of the STOMP adapter can be obtained -from -. +## Supported STOMP Versions -Full usage instructions can be found at -. +1.0 through 1.2. + +## Documentation + +[RabbitMQ STOMP plugin documentation](http://www.rabbitmq.com/stomp.html). diff --git a/plugins-src/rabbitmq-stomp/deps/stomppy/Makefile b/plugins-src/rabbitmq-stomp/deps/stomppy/Makefile index a937fb5..40f5bd1 100644 --- a/plugins-src/rabbitmq-stomp/deps/stomppy/Makefile +++ b/plugins-src/rabbitmq-stomp/deps/stomppy/Makefile @@ -1,8 +1,8 @@ -UPSTREAM_HG=https://stomppy.googlecode.com/hg/ -REVISION=16a4000624a7 +UPSTREAM_GIT=https://github.com/jasonrbriggs/stomp.py.git +REVISION=v4.0.16 LIB_DIR=stomppy -CHECKOUT_DIR=stomppy-hg +CHECKOUT_DIR=stomppy-git TARGETS=$(LIB_DIR) @@ -14,14 +14,13 @@ distclean: clean rm -rf $(CHECKOUT_DIR) -$(LIB_DIR) : $(CHECKOUT_DIR) rabbit.patch +$(LIB_DIR) : $(CHECKOUT_DIR) rm -rf $@ cp -R $< $@ - cd $@ && patch -p1 < ../rabbit.patch $(CHECKOUT_DIR): - hg clone $(UPSTREAM_HG) $@ - (cd $@ && hg up $(REVISION)) || rm -rf $@ + git clone $(UPSTREAM_GIT) $@ + (cd $@ && git checkout $(REVISION)) || rm -rf $@ echo-revision: @echo $(REVISION) diff --git a/plugins-src/rabbitmq-stomp/deps/stomppy/rabbit.patch b/plugins-src/rabbitmq-stomp/deps/stomppy/rabbit.patch deleted file mode 100644 index 05b773f..0000000 --- a/plugins-src/rabbitmq-stomp/deps/stomppy/rabbit.patch +++ /dev/null @@ -1,116 +0,0 @@ -diff -r 16a4000624a7 stomp/connect.py ---- a/stomp/connect.py Sun May 02 18:15:34 2010 +0100 -+++ b/stomp/connect.py Mon Oct 20 19:35:44 2014 +0100 -@@ -88,7 +88,10 @@ - ssl_key_file = None, - ssl_cert_file = None, - ssl_ca_certs = None, -- ssl_cert_validator = None): -+ ssl_cert_validator = None, -+ version = None, -+ heartbeat = None, -+ virtual_host = None): - """ - Initialize and start this connection. - -@@ -159,6 +162,16 @@ - - where OK is a boolean, and cert is a certificate structure - as returned by ssl.SSLSocket.getpeercert() -+ -+ \param version -+ (optional) stomp version header to send (comma separated) -+ -+ \param heartbeat -+ (optional) heartbeat header to send (STOMP 1.1) -+ -+ \param virtual_host -+ (optional) virtual_host header to send (STOMP 1.1) -+ - """ - - sorted_host_and_ports = [] -@@ -205,6 +218,15 @@ - self.__connect_headers['login'] = user - self.__connect_headers['passcode'] = passcode - -+ if version is not None: -+ self.__connect_headers['accept-version'] = version -+ -+ if heartbeat is not None: -+ self.__connect_headers['heart-beat'] = heartbeat -+ -+ if virtual_host is not None: -+ self.__connect_headers['host'] = virtual_host -+ - self.__socket = None - self.__socket_semaphore = threading.BoundedSemaphore(1) - self.__current_host_and_port = None -@@ -383,6 +405,10 @@ - """ - self.__send_frame_helper('DISCONNECT', '', utils.merge_headers([self.__connect_headers, headers, keyword_headers]), [ ]) - self.__running = False -+ self.close_socket() -+ self.__current_host_and_port = None -+ -+ def close_socket(self): - if self.__socket is not None: - if self.__ssl: - # -@@ -390,20 +416,23 @@ - # - try: - self.__socket = self.__socket.unwrap() -- except Exception: -+ except Exception as e: - # - # unwrap seems flaky on Win with the backported ssl mod, so catch any exception and log it - # -- _, e, _ = sys.exc_info() -- log.warn(e) -+ log.warning("socket unwrap() threw exception: %s" % e) - elif hasattr(socket, 'SHUT_RDWR'): -- self.__socket.shutdown(socket.SHUT_RDWR) -+ try: -+ self.__socket.shutdown(socket.SHUT_RDWR) -+ except Exception as e: -+ log.warning("socket shutdown() threw exception: %s" % e) - # -- # split this into a separate check, because sometimes the socket is nulled between shutdown and this call -+ # caution, because sometimes the socket is nulled between shutdown and this call - # -- if self.__socket is not None: -+ try: - self.__socket.close() -- self.__current_host_and_port = None -+ except Exception as e: -+ log.warning("socket close() threw exception: %s" % e) - - def __convert_dict(self, payload): - """ -@@ -449,6 +478,9 @@ - raise KeyError("Command %s requires header %r" % (command, required_header_key)) - self.__send_frame(command, headers, payload) - -+ def send_frame(self, command, headers={}, payload=''): -+ self.__send_frame(command, headers, payload) -+ - def __send_frame(self, command, headers={}, payload=''): - """ - Send a STOMP frame. -@@ -638,7 +670,7 @@ - cert_validation = ssl.CERT_NONE - self.__socket = ssl.wrap_socket(self.__socket, keyfile = self.__ssl_key_file, - certfile = self.__ssl_cert_file, cert_reqs = cert_validation, -- ca_certs=self.__ssl_ca_certs, ssl_version = ssl.PROTOCOL_SSLv3) -+ ca_certs=self.__ssl_ca_certs, ssl_version = ssl.PROTOCOL_TLSv1) - self.__socket.settimeout(None) - if self.blocking is not None: - self.__socket.setblocking(self.blocking) -@@ -680,4 +712,4 @@ - sleep_exp += 1 - - if not self.__socket: -- raise exception.ReconnectFailedException -\ No newline at end of file -+ raise exception.ReconnectFailedException diff --git a/plugins-src/rabbitmq-stomp/include/rabbit_stomp.hrl b/plugins-src/rabbitmq-stomp/include/rabbit_stomp.hrl index 62504a0..d1497f4 100644 --- a/plugins-src/rabbitmq-stomp/include/rabbit_stomp.hrl +++ b/plugins-src/rabbitmq-stomp/include/rabbit_stomp.hrl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -record(stomp_configuration, {default_login, diff --git a/plugins-src/rabbitmq-stomp/include/rabbit_stomp_frame.hrl b/plugins-src/rabbitmq-stomp/include/rabbit_stomp_frame.hrl index 77a946c..77d5810 100644 --- a/plugins-src/rabbitmq-stomp/include/rabbit_stomp_frame.hrl +++ b/plugins-src/rabbitmq-stomp/include/rabbit_stomp_frame.hrl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -record(stomp_frame, {command, headers, body_iolist}). diff --git a/plugins-src/rabbitmq-stomp/include/rabbit_stomp_headers.hrl b/plugins-src/rabbitmq-stomp/include/rabbit_stomp_headers.hrl index c7ab43c..398ce42 100644 --- a/plugins-src/rabbitmq-stomp/include/rabbit_stomp_headers.hrl +++ b/plugins-src/rabbitmq-stomp/include/rabbit_stomp_headers.hrl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2011-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2011-2015 Pivotal Software, Inc. All rights reserved. %% -define(HEADER_ACCEPT_VERSION, "accept-version"). diff --git a/plugins-src/rabbitmq-stomp/package.mk b/plugins-src/rabbitmq-stomp/package.mk index aff71f0..67cb2c8 100644 --- a/plugins-src/rabbitmq-stomp/package.mk +++ b/plugins-src/rabbitmq-stomp/package.mk @@ -1,8 +1,8 @@ RELEASABLE:=true DEPS:=rabbitmq-server rabbitmq-erlang-client rabbitmq-test -STANDALONE_TEST_COMMANDS:=eunit:test([rabbit_stomp_test_util,rabbit_stomp_test_frame],[verbose]) +#STANDALONE_TEST_COMMANDS:=eunit:test([rabbit_stomp_test_util,rabbit_stomp_test_frame],[verbose]) WITH_BROKER_TEST_SCRIPTS:=$(PACKAGE_DIR)/test/src/test.py $(PACKAGE_DIR)/test/src/test_connect_options.py $(PACKAGE_DIR)/test/src/test_ssl.py -WITH_BROKER_TEST_COMMANDS:=rabbit_stomp_test:all_tests() rabbit_stomp_amqqueue_test:all_tests() +#WITH_BROKER_TEST_COMMANDS:=rabbit_stomp_test:all_tests() rabbit_stomp_amqqueue_test:all_tests() WITH_BROKER_TEST_CONFIG:=$(PACKAGE_DIR)/test/ebin/test define package_rules @@ -12,13 +12,13 @@ mkdir $(PACKAGE_DIR)/test/certs mkdir -p $(PACKAGE_DIR)/test/ebin sed -e "s|%%CERTS_DIR%%|$(abspath $(PACKAGE_DIR))/test/certs|g" < $(PACKAGE_DIR)/test/src/test.config > $(PACKAGE_DIR)/test/ebin/test.config - make -C $(PACKAGE_DIR)/../rabbitmq-test/certs all PASSWORD=test DIR=$(abspath $(PACKAGE_DIR))/test/certs - make -C $(PACKAGE_DIR)/deps/stomppy + $(MAKE) -C $(PACKAGE_DIR)/../rabbitmq-test/certs all PASSWORD=test DIR=$(abspath $(PACKAGE_DIR))/test/certs + $(MAKE) -C $(PACKAGE_DIR)/deps/stomppy $(PACKAGE_DIR)+clean:: rm -rf $(PACKAGE_DIR)/test/certs $(PACKAGE_DIR)+clean-with-deps:: - make -C $(PACKAGE_DIR)/deps/stomppy distclean + $(MAKE) -C $(PACKAGE_DIR)/deps/stomppy distclean endef diff --git a/plugins-src/rabbitmq-stomp/src/rabbit_stomp.erl b/plugins-src/rabbitmq-stomp/src/rabbit_stomp.erl index bb8f7f9..bd867aa 100644 --- a/plugins-src/rabbitmq-stomp/src/rabbit_stomp.erl +++ b/plugins-src/rabbitmq-stomp/src/rabbit_stomp.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_stomp). diff --git a/plugins-src/rabbitmq-stomp/src/rabbit_stomp_client_sup.erl b/plugins-src/rabbitmq-stomp/src/rabbit_stomp_client_sup.erl index d0f41b7..4f293ed 100644 --- a/plugins-src/rabbitmq-stomp/src/rabbit_stomp_client_sup.erl +++ b/plugins-src/rabbitmq-stomp/src/rabbit_stomp_client_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_stomp_client_sup). diff --git a/plugins-src/rabbitmq-stomp/src/rabbit_stomp_frame.erl b/plugins-src/rabbitmq-stomp/src/rabbit_stomp_frame.erl index 9f30e9b..ecd6365 100644 --- a/plugins-src/rabbitmq-stomp/src/rabbit_stomp_frame.erl +++ b/plugins-src/rabbitmq-stomp/src/rabbit_stomp_frame.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% stomp_frame implements the STOMP framing protocol "version 1.0", as @@ -151,9 +151,11 @@ false -> [{Name, Value} | Headers] end. -parse_body(Content, Frame) -> - parse_body(Content, Frame, [], - integer_header(Frame, ?HEADER_CONTENT_LENGTH, unknown)). +parse_body(Content, Frame = #stomp_frame{command = Command}) -> + case Command of + "SEND" -> parse_body(Content, Frame, [], integer_header(Frame, ?HEADER_CONTENT_LENGTH, unknown)); + _ -> parse_body(Content, Frame, [], unknown) + end. parse_body(Content, Frame, Chunks, unknown) -> parse_body2(Content, Frame, Chunks, case firstnull(Content) of @@ -231,7 +233,7 @@ Len > 0 -> [?HEADER_CONTENT_LENGTH ++ ":", integer_to_list(Len), ?LF]; true -> [] end, - ?LF, BodyFragments, 0]. + ?LF, BodyFragments, 0, ?LF]. serialize_header({K, V}) when is_integer(V) -> hdr(escape(K), integer_to_list(V)); serialize_header({K, V}) when is_list(V) -> hdr(escape(K), escape(V)). diff --git a/plugins-src/rabbitmq-stomp/src/rabbit_stomp_processor.erl b/plugins-src/rabbitmq-stomp/src/rabbit_stomp_processor.erl index a8ff5a6..0a6dae7 100644 --- a/plugins-src/rabbitmq-stomp/src/rabbit_stomp_processor.erl +++ b/plugins-src/rabbitmq-stomp/src/rabbit_stomp_processor.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_stomp_processor). diff --git a/plugins-src/rabbitmq-stomp/src/rabbit_stomp_reader.erl b/plugins-src/rabbitmq-stomp/src/rabbit_stomp_reader.erl index 47572e9..673afee 100644 --- a/plugins-src/rabbitmq-stomp/src/rabbit_stomp_reader.erl +++ b/plugins-src/rabbitmq-stomp/src/rabbit_stomp_reader.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_stomp_reader). @@ -74,15 +74,18 @@ catch _:Ex -> log_network_error(ConnStr, Ex), rabbit_net:fast_close(Sock), + rabbit_stomp_processor:flush_and_die(ProcessorPid), exit(normal) end, done; {error, enotconn} -> rabbit_net:fast_close(Sock0), + rabbit_stomp_processor:flush_and_die(ProcessorPid), exit(normal); {error, Reason} -> log_network_error(ConnStr, Reason), rabbit_net:fast_close(Sock0), + rabbit_stomp_processor:flush_and_die(ProcessorPid), exit(normal) end end diff --git a/plugins-src/rabbitmq-stomp/src/rabbit_stomp_sup.erl b/plugins-src/rabbitmq-stomp/src/rabbit_stomp_sup.erl index 0d58ca9..d376e5e 100644 --- a/plugins-src/rabbitmq-stomp/src/rabbit_stomp_sup.erl +++ b/plugins-src/rabbitmq-stomp/src/rabbit_stomp_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_stomp_sup). diff --git a/plugins-src/rabbitmq-stomp/src/rabbit_stomp_util.erl b/plugins-src/rabbitmq-stomp/src/rabbit_stomp_util.erl index 777b708..bb8530e 100644 --- a/plugins-src/rabbitmq-stomp/src/rabbit_stomp_util.erl +++ b/plugins-src/rabbitmq-stomp/src/rabbit_stomp_util.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_stomp_util). diff --git a/plugins-src/rabbitmq-stomp/test/src/ack.py b/plugins-src/rabbitmq-stomp/test/src/ack.py index 699fede..4c47cd3 100644 --- a/plugins-src/rabbitmq-stomp/test/src/ack.py +++ b/plugins-src/rabbitmq-stomp/test/src/ack.py @@ -6,14 +6,15 @@ class TestAck(base.BaseTest): def test_ack_client(self): - d = "/queue/ack-test" + destination = "/queue/ack-test" # subscribe and send message self.listener.reset(2) ## expecting 2 messages - self.conn.subscribe(destination=d, ack='client', + self.subscribe_dest(self.conn, destination, None, + ack='client', headers={'prefetch-count': '10'}) - self.conn.send("test1", destination=d) - self.conn.send("test2", destination=d) + self.conn.send(destination, "test1") + self.conn.send(destination, "test2") self.assertTrue(self.listener.await(4), "initial message not received") self.assertEquals(2, len(self.listener.messages)) @@ -26,37 +27,39 @@ listener2 = base.WaitableListener() listener2.reset(2) conn2.set_listener('', listener2) - conn2.subscribe(destination=d, ack='client', - headers={'prefetch-count': '10'}) + self.subscribe_dest(conn2, destination, None, + ack='client', + headers={'prefetch-count': '10'}) self.assertTrue(listener2.await(), "message not received again") self.assertEquals(2, len(listener2.messages)) # now ack only the last message - expecting cumulative behaviour - mid = listener2.messages[1]['headers']['message-id'] - conn2.ack({'message-id':mid}) - finally: - conn2.stop() + mid = listener2.messages[1]['headers'][self.ack_id_source_header] + self.ack_message(conn2, mid, None) + finally: + conn2.disconnect() # now reconnect again, shouldn't see the message conn3 = self.create_connection() try: listener3 = base.WaitableListener() conn3.set_listener('', listener3) - conn3.subscribe(destination=d) + self.subscribe_dest(conn3, destination, None) self.assertFalse(listener3.await(3), "unexpected message. ACK not working?") finally: - conn3.stop() + conn3.disconnect() def test_ack_client_individual(self): - d = "/queue/ack-test-individual" + destination = "/queue/ack-test-individual" # subscribe and send message self.listener.reset(2) ## expecting 2 messages - self.conn.subscribe(destination=d, ack='client-individual', + self.subscribe_dest(self.conn, destination, None, + ack='client-individual', headers={'prefetch-count': '10'}) - self.conn.send("test1", destination=d) - self.conn.send("test2", destination=d) + self.conn.send(destination, "test1") + self.conn.send(destination, "test2") self.assertTrue(self.listener.await(4), "Both initial messages not received") self.assertEquals(2, len(self.listener.messages)) @@ -69,8 +72,9 @@ listener2 = base.WaitableListener() listener2.reset(2) ## expect 2 messages conn2.set_listener('', listener2) - conn2.subscribe(destination=d, ack='client-individual', - headers={'prefetch-count': '10'}) + self.subscribe_dest(conn2, destination, None, + ack='client-individual', + headers={'prefetch-count': '10'}) self.assertTrue(listener2.await(2.5), "Did not receive 2 messages") self.assertEquals(2, len(listener2.messages), "Not exactly 2 messages received") @@ -79,13 +83,13 @@ mid = None for ind in range(nummsgs): if listener2.messages[ind]['message']=="test2": - mid = listener2.messages[ind]['headers']['message-id'] + mid = listener2.messages[ind]['headers'][self.ack_id_source_header] self.assertEquals(1, ind, 'Expecting test2 to be second message') break self.assertTrue(mid, "Did not find test2 message id.") - conn2.ack({'message-id':mid}) - finally: - conn2.stop() + self.ack_message(conn2, mid, None) + finally: + conn2.disconnect() # now reconnect again, shouldn't see the message conn3 = self.create_connection() @@ -93,21 +97,21 @@ listener3 = base.WaitableListener() listener3.reset(2) ## expecting a single message, but wait for two conn3.set_listener('', listener3) - conn3.subscribe(destination=d) + self.subscribe_dest(conn3, destination, None) self.assertFalse(listener3.await(2.5), "Expected to see only one message. ACK not working?") self.assertEquals(1, len(listener3.messages), "Expecting exactly one message") self.assertEquals("test1", listener3.messages[0]['message'], "Unexpected message remains") finally: - conn3.stop() + conn3.disconnect() def test_ack_client_tx(self): - d = "/queue/ack-test-tx" + destination = "/queue/ack-test-tx" # subscribe and send message self.listener.reset() - self.conn.subscribe(destination=d, ack='client') - self.conn.send("test", destination=d) + self.subscribe_dest(self.conn, destination, None, ack='client') + self.conn.send(destination, "test") self.assertTrue(self.listener.await(3), "initial message not received") self.assertEquals(1, len(self.listener.messages)) @@ -121,90 +125,94 @@ listener2 = base.WaitableListener() conn2.set_listener('', listener2) conn2.begin(transaction=tx) - conn2.subscribe(destination=d, ack='client') + self.subscribe_dest(conn2, destination, None, ack='client') self.assertTrue(listener2.await(), "message not received again") self.assertEquals(1, len(listener2.messages)) # now ack - mid = listener2.messages[0]['headers']['message-id'] - conn2.ack({'message-id':mid, 'transaction':tx}) + mid = listener2.messages[0]['headers'][self.ack_id_source_header] + self.ack_message(conn2, mid, None, transaction=tx) #now commit conn2.commit(transaction=tx) finally: - conn2.stop() + conn2.disconnect() # now reconnect again, shouldn't see the message conn3 = self.create_connection() try: listener3 = base.WaitableListener() conn3.set_listener('', listener3) - conn3.subscribe(destination=d) + self.subscribe_dest(conn3, destination, None) self.assertFalse(listener3.await(3), "unexpected message. TX ACK not working?") finally: - conn3.stop() + conn3.disconnect() def test_topic_prefetch(self): - d = "/topic/prefetch-test" + destination = "/topic/prefetch-test" # subscribe and send message self.listener.reset(6) ## expect 6 messages - self.conn.subscribe(destination=d, ack='client', + self.subscribe_dest(self.conn, destination, None, + ack='client', headers={'prefetch-count': '5'}) for x in range(10): - self.conn.send("test" + str(x), destination=d) + self.conn.send(destination, "test" + str(x)) self.assertFalse(self.listener.await(3), "Should not have been able to see 6 messages") self.assertEquals(5, len(self.listener.messages)) def test_nack(self): - d = "/queue/nack-test" + destination = "/queue/nack-test" #subscribe and send - self.conn.subscribe(destination=d, ack='client-individual') - self.conn.send("nack-test", destination=d) + self.subscribe_dest(self.conn, destination, None, + ack='client-individual') + self.conn.send(destination, "nack-test") self.assertTrue(self.listener.await(), "Not received message") - message_id = self.listener.messages[0]['headers']['message-id'] + message_id = self.listener.messages[0]['headers'][self.ack_id_source_header] self.listener.reset() - self.conn.send_frame("NACK", {"message-id" : message_id}) + self.nack_message(self.conn, message_id, None) self.assertTrue(self.listener.await(), "Not received message after NACK") - message_id = self.listener.messages[0]['headers']['message-id'] - self.conn.ack({'message-id' : message_id}) + message_id = self.listener.messages[0]['headers'][self.ack_id_source_header] + self.ack_message(self.conn, message_id, None) def test_nack_multi(self): - d = "/queue/nack-multi" + destination = "/queue/nack-multi" self.listener.reset(2) #subscribe and send - self.conn.subscribe(destination=d, ack='client', + self.subscribe_dest(self.conn, destination, None, + ack='client', headers = {'prefetch-count' : '10'}) - self.conn.send("nack-test1", destination=d) - self.conn.send("nack-test2", destination=d) + self.conn.send(destination, "nack-test1") + self.conn.send(destination, "nack-test2") self.assertTrue(self.listener.await(), "Not received messages") - message_id = self.listener.messages[1]['headers']['message-id'] + message_id = self.listener.messages[1]['headers'][self.ack_id_source_header] self.listener.reset(2) - self.conn.send_frame("NACK", {"message-id" : message_id}) + self.nack_message(self.conn, message_id, None) self.assertTrue(self.listener.await(), "Not received message again") - message_id = self.listener.messages[1]['headers']['message-id'] - self.conn.ack({'message-id' : message_id}) + message_id = self.listener.messages[1]['headers'][self.ack_id_source_header] + self.ack_message(self.conn, message_id, None) def test_nack_without_requeueing(self): - d = "/queue/nack-test-no-requeue" - - self.conn.subscribe(destination=d, ack='client-individual') - self.conn.send("nack-test", destination=d) + destination = "/queue/nack-test-no-requeue" + + self.subscribe_dest(self.conn, destination, None, + ack='client-individual') + self.conn.send(destination, "nack-test") self.assertTrue(self.listener.await(), "Not received message") - message_id = self.listener.messages[0]['headers']['message-id'] + message_id = self.listener.messages[0]['headers'][self.ack_id_source_header] self.listener.reset() - self.conn.send_frame("NACK", {"message-id" : message_id, "requeue": False}) + self.conn.send_frame("NACK", {self.ack_id_header: message_id, "requeue": False}) self.assertFalse(self.listener.await(4), "Received message after NACK with requeue = False") diff --git a/plugins-src/rabbitmq-stomp/test/src/base.py b/plugins-src/rabbitmq-stomp/test/src/base.py index 4db8433..e3d5819 100644 --- a/plugins-src/rabbitmq-stomp/test/src/base.py +++ b/plugins-src/rabbitmq-stomp/test/src/base.py @@ -6,18 +6,84 @@ class BaseTest(unittest.TestCase): - def create_connection(self, version=None, heartbeat=None): - conn = stomp.Connection(user="guest", passcode="guest", - version=version, heartbeat=heartbeat) + def create_connection_obj(self, version='1.0', vhost='/', heartbeats=(0, 0)): + if version == '1.0': + conn = stomp.StompConnection10() + self.ack_id_source_header = 'message-id' + self.ack_id_header = 'message-id' + elif version == '1.1': + conn = stomp.StompConnection11(vhost=vhost, + heartbeats=heartbeats) + self.ack_id_source_header = 'message-id' + self.ack_id_header = 'message-id' + elif version == '1.2': + conn = stomp.StompConnection12(vhost=vhost, + heartbeats=heartbeats) + self.ack_id_source_header = 'ack' + self.ack_id_header = 'id' + else: + conn = stomp.StompConnection12(vhost=vhost, + heartbeats=heartbeats) + conn.version = version + return conn + + def create_connection(self, user='guest', passcode='guest', wait=True, **kwargs): + conn = self.create_connection_obj(**kwargs) conn.start() - conn.connect() + conn.connect(user, passcode, wait=wait) return conn + + def subscribe_dest(self, conn, destination, sub_id, **kwargs): + if type(conn) is stomp.StompConnection10: + # 'id' is optional in STOMP 1.0. + if sub_id != None: + kwargs['id'] = sub_id + conn.subscribe(destination, **kwargs) + else: + # 'id' is required in STOMP 1.1+. + if sub_id == None: + sub_id = 'ctag' + conn.subscribe(destination, sub_id, **kwargs) + + def unsubscribe_dest(self, conn, destination, sub_id, **kwargs): + if type(conn) is stomp.StompConnection10: + # 'id' is optional in STOMP 1.0. + if sub_id != None: + conn.unsubscribe(id=sub_id, **kwargs) + else: + conn.unsubscribe(destination=destination, **kwargs) + else: + # 'id' is required in STOMP 1.1+. + if sub_id == None: + sub_id = 'ctag' + conn.unsubscribe(sub_id, **kwargs) + + def ack_message(self, conn, msg_id, sub_id, **kwargs): + if type(conn) is stomp.StompConnection10: + conn.ack(msg_id, **kwargs) + elif type(conn) is stomp.StompConnection11: + if sub_id == None: + sub_id = 'ctag' + conn.ack(msg_id, sub_id, **kwargs) + elif type(conn) is stomp.StompConnection12: + conn.ack(msg_id, **kwargs) + + def nack_message(self, conn, msg_id, sub_id, **kwargs): + if type(conn) is stomp.StompConnection10: + # Normally unsupported by STOMP 1.0. + conn.send_frame("NACK", {"message-id": msg_id}) + elif type(conn) is stomp.StompConnection11: + if sub_id == None: + sub_id = 'ctag' + conn.nack(msg_id, sub_id, **kwargs) + elif type(conn) is stomp.StompConnection12: + conn.nack(msg_id, **kwargs) def create_subscriber_connection(self, dest): conn = self.create_connection() listener = WaitableListener() conn.set_listener('', listener) - conn.subscribe(destination=dest, receipt="sub.receipt") + self.subscribe_dest(conn, dest, None, receipt="sub.receipt") listener.await() self.assertEquals(1, len(listener.receipts)) listener.reset() @@ -30,13 +96,14 @@ def tearDown(self): if self.conn.is_connected(): + self.conn.disconnect() self.conn.stop() def simple_test_send_rec(self, dest, route = None): self.listener.reset() - self.conn.subscribe(destination=dest) - self.conn.send("foo", destination=dest) + self.subscribe_dest(self.conn, dest, None) + self.conn.send(dest, "foo") self.assertTrue(self.listener.await(), "Timeout, no message received") diff --git a/plugins-src/rabbitmq-stomp/test/src/connect_options.py b/plugins-src/rabbitmq-stomp/test/src/connect_options.py index c9e4ad5..d802bc6 100644 --- a/plugins-src/rabbitmq-stomp/test/src/connect_options.py +++ b/plugins-src/rabbitmq-stomp/test/src/connect_options.py @@ -14,7 +14,8 @@ new_conn.set_listener('', listener) new_conn.start() # not going to issue connect - new_conn.subscribe(destination="/topic/implicit", id='sub_implicit', receipt='implicit') + self.subscribe_dest(new_conn, "/topic/implicit", 'sub_implicit', + receipt='implicit') try: self.assertTrue(listener.await(5)) diff --git a/plugins-src/rabbitmq-stomp/test/src/destinations.py b/plugins-src/rabbitmq-stomp/test/src/destinations.py index 964885c..b1d0cd1 100644 --- a/plugins-src/rabbitmq-stomp/test/src/destinations.py +++ b/plugins-src/rabbitmq-stomp/test/src/destinations.py @@ -25,7 +25,8 @@ def test_invalid_exchange(self): ''' Test invalid exchange error ''' self.listener.reset(1) - self.conn.subscribe(destination="/exchange/does.not.exist") + self.subscribe_dest(self.conn, "/exchange/does.not.exist", None, + ack="auto") self.assertListener("Expecting an error", numErrs=1) err = self.listener.errors[0] self.assertEquals("not_found", err['headers']['message']) @@ -49,15 +50,15 @@ def test_send_receive(self): ''' Test basic send/receive for /queue ''' - d = '/queue/test' - self.simple_test_send_rec(d) + destination = '/queue/test' + self.simple_test_send_rec(destination) def test_send_receive_in_other_conn(self): ''' Test send in one connection, receive in another ''' - d = '/queue/test2' + destination = '/queue/test2' # send - self.conn.send("hello", destination=d) + self.conn.send(destination, "hello") # now receive conn2 = self.create_connection() @@ -65,19 +66,19 @@ listener2 = base.WaitableListener() conn2.set_listener('', listener2) - conn2.subscribe(destination=d) + self.subscribe_dest(conn2, destination, None, ack="auto") self.assertTrue(listener2.await(10), "no receive") finally: - conn2.stop() + conn2.disconnect() def test_send_receive_in_other_conn_with_disconnect(self): ''' Test send, disconnect, receive ''' - d = '/queue/test3' + destination = '/queue/test3' # send - self.conn.send("hello thar", destination=d, receipt="foo") + self.conn.send(destination, "hello thar", receipt="foo") self.listener.await(3) - self.conn.stop() + self.conn.disconnect() # now receive conn2 = self.create_connection() @@ -85,24 +86,24 @@ listener2 = base.WaitableListener() conn2.set_listener('', listener2) - conn2.subscribe(destination=d) + self.subscribe_dest(conn2, destination, None, ack="auto") self.assertTrue(listener2.await(10), "no receive") finally: - conn2.stop() + conn2.disconnect() def test_multi_subscribers(self): ''' Test multiple subscribers against a single /queue destination ''' - d = '/queue/test-multi' + destination = '/queue/test-multi' ## set up two subscribers - conn1, listener1 = self.create_subscriber_connection(d) - conn2, listener2 = self.create_subscriber_connection(d) + conn1, listener1 = self.create_subscriber_connection(destination) + conn2, listener2 = self.create_subscriber_connection(destination) try: ## now send - self.conn.send("test1", destination=d) - self.conn.send("test2", destination=d) + self.conn.send(destination, "test1") + self.conn.send(destination, "test2") ## expect both consumers to get a message? self.assertTrue(listener1.await(2)) @@ -112,16 +113,16 @@ self.assertEquals(1, len(listener2.messages), "unexpected message count") finally: - conn1.stop() - conn2.stop() + conn1.disconnect() + conn2.disconnect() def test_send_with_receipt(self): - d = '/queue/test-receipt' + destination = '/queue/test-receipt' def noop(): pass - self.__test_send_receipt(d, noop, noop) + self.__test_send_receipt(destination, noop, noop) def test_send_with_receipt_tx(self): - d = '/queue/test-receipt-tx' + destination = '/queue/test-receipt-tx' tx = 'receipt.tx' def before(): @@ -131,19 +132,19 @@ self.assertFalse(self.listener.await(1)) self.conn.commit(transaction=tx) - self.__test_send_receipt(d, before, after, {'transaction': tx}) + self.__test_send_receipt(destination, before, after, {'transaction': tx}) def test_interleaved_receipt_no_receipt(self): ''' Test i-leaved receipt/no receipt, no-r bracketed by rs ''' - d = '/queue/ir' + destination = '/queue/ir' self.listener.reset(5) - self.conn.subscribe(destination=d) - self.conn.send('first', destination=d, receipt='a') - self.conn.send('second', destination=d) - self.conn.send('third', destination=d, receipt='b') + self.subscribe_dest(self.conn, destination, None, ack="auto") + self.conn.send(destination, 'first', receipt='a') + self.conn.send(destination, 'second') + self.conn.send(destination, 'third', receipt='b') self.assertListener("Missing messages/receipts", numMsgs=3, numRcts=2, timeout=3) @@ -152,18 +153,18 @@ def test_interleaved_receipt_no_receipt_tx(self): ''' Test i-leaved receipt/no receipt, no-r bracketed by r+xactions ''' - d = '/queue/ir' + destination = '/queue/ir' tx = 'tx.ir' # three messages and two receipts self.listener.reset(5) - self.conn.subscribe(destination=d) + self.subscribe_dest(self.conn, destination, None, ack="auto") self.conn.begin(transaction=tx) - self.conn.send('first', destination=d, receipt='a', transaction=tx) - self.conn.send('second', destination=d, transaction=tx) - self.conn.send('third', destination=d, receipt='b', transaction=tx) + self.conn.send(destination, 'first', receipt='a', transaction=tx) + self.conn.send(destination, 'second', transaction=tx) + self.conn.send(destination, 'third', receipt='b', transaction=tx) self.conn.commit(transaction=tx) self.assertListener("Missing messages/receipts", numMsgs=3, numRcts=2, timeout=40) @@ -176,14 +177,14 @@ def test_interleaved_receipt_no_receipt_inverse(self): ''' Test i-leaved receipt/no receipt, r bracketed by no-rs ''' - d = '/queue/ir' + destination = '/queue/ir' self.listener.reset(4) - self.conn.subscribe(destination=d) - self.conn.send('first', destination=d) - self.conn.send('second', destination=d, receipt='a') - self.conn.send('third', destination=d) + self.subscribe_dest(self.conn, destination, None, ack="auto") + self.conn.send(destination, 'first') + self.conn.send(destination, 'second', receipt='a') + self.conn.send(destination, 'third') self.assertListener("Missing messages/receipt", numMsgs=3, numRcts=1, timeout=3) @@ -199,7 +200,7 @@ for x in range(0, count): receipt = "test" + str(x) expected_receipts.add(receipt) - self.conn.send("test receipt", destination=destination, + self.conn.send(destination, "test receipt", receipt=receipt, headers=headers) after() @@ -221,16 +222,16 @@ def test_send_receive(self): ''' Test basic send/receive for /topic ''' - d = '/topic/test' - self.simple_test_send_rec(d) + destination = '/topic/test' + self.simple_test_send_rec(destination) def test_send_multiple(self): ''' Test /topic with multiple consumers ''' - d = '/topic/multiple' + destination = '/topic/multiple' ## set up two subscribers - conn1, listener1 = self.create_subscriber_connection(d) - conn2, listener2 = self.create_subscriber_connection(d) + conn1, listener1 = self.create_subscriber_connection(destination) + conn2, listener2 = self.create_subscriber_connection(destination) try: ## listeners are expecting 2 messages @@ -238,8 +239,8 @@ listener2.reset(2) ## now send - self.conn.send("test1", destination=d) - self.conn.send("test2", destination=d) + self.conn.send(destination, "test1") + self.conn.send(destination, "test2") ## expect both consumers to get both messages self.assertTrue(listener1.await(5)) @@ -249,8 +250,38 @@ self.assertEquals(2, len(listener2.messages), "unexpected message count") finally: - conn1.stop() - conn2.stop() + conn1.disconnect() + conn2.disconnect() + + def test_send_multiple_with_a_large_message(self): + ''' Test /topic with multiple consumers ''' + destination = '/topic/16mb' + # payload size + s = 1024 * 1024 * 16 + message = 'x' * s + + conn1, listener1 = self.create_subscriber_connection(destination) + conn2, listener2 = self.create_subscriber_connection(destination) + + try: + listener1.reset(2) + listener2.reset(2) + + self.conn.send(destination, message) + self.conn.send(destination, message) + + self.assertTrue(listener1.await(10)) + self.assertEquals(2, len(listener1.messages), + "unexpected message count") + self.assertTrue(len(listener2.messages[0]['message']) == s, + "unexpected message size") + + self.assertTrue(listener2.await(10)) + self.assertEquals(2, len(listener2.messages), + "unexpected message count") + finally: + conn1.disconnect() + conn2.disconnect() class TestReplyQueue(base.BaseTest): @@ -268,7 +299,7 @@ conn2, listener2 = self.create_subscriber_connection(known) try: - self.conn.send("test", destination=known, + self.conn.send(known, "test", headers = {"reply-to": reply}) self.assertTrue(listener2.await(5)) @@ -277,11 +308,11 @@ reply_to = listener2.messages[0]['headers']['reply-to'] self.assertTrue(reply_to.startswith('/reply-queue/')) - conn2.send("reply", destination=reply_to) + conn2.send(reply_to, "reply") self.assertTrue(self.listener.await(5)) self.assertEquals("reply", self.listener.messages[0]['message']) finally: - conn2.stop() + conn2.disconnect() def test_reuse_reply_queue(self): ''' Test re-use of reply-to queue ''' @@ -295,7 +326,7 @@ self.assertEquals(1, len(listna.messages)) reply_to = listna.messages[0]['headers']['reply-to'] self.assertTrue(reply_to.startswith('/reply-queue/')) - cntn.send("reply", destination=reply_to) + cntn.send(reply_to, "reply") ## Client 1 uses pre-supplied connection and listener ## Set up clients 2 and 3 @@ -303,9 +334,9 @@ conn3, listener3 = self.create_subscriber_connection(known3) try: self.listener.reset(2) - self.conn.send("test2", destination=known2, + self.conn.send(known2, "test2", headers = {"reply-to": reply}) - self.conn.send("test3", destination=known3, + self.conn.send(known3, "test3", headers = {"reply-to": reply}) respond(conn2, listener2) respond(conn3, listener3) @@ -315,8 +346,8 @@ self.assertEquals("reply", self.listener.messages[0]['message']) self.assertEquals("reply", self.listener.messages[1]['message']) finally: - conn2.stop() - conn3.stop() + conn2.disconnect() + conn3.disconnect() def test_perm_reply_queue(self): '''As test_reply_queue, but with a non-temp reply queue''' @@ -330,7 +361,7 @@ conn2, listener2 = self.create_subscriber_connection(known) try: - conn1.send("test", destination=known, + conn1.send(known, "test", headers = {"reply-to": reply}) self.assertTrue(listener2.await(5)) @@ -339,12 +370,12 @@ reply_to = listener2.messages[0]['headers']['reply-to'] self.assertTrue(reply_to == reply) - conn2.send("reply", destination=reply_to) + conn2.send(reply_to, "reply") self.assertTrue(listener1.await(5)) self.assertEquals("reply", listener1.messages[0]['message']) finally: - conn1.stop() - conn2.stop() + conn1.disconnect() + conn2.disconnect() class TestDurableSubscription(base.BaseTest): @@ -356,10 +387,9 @@ if not id: id = TestDurableSubscription.ID - conn.subscribe(destination=dest, - headers ={'persistent': 'true', - 'receipt': 1, - 'id': id}) + self.subscribe_dest(conn, dest, id, ack="auto", + headers = {'persistent': 'true', + 'receipt': 1}) def __assert_receipt(self, listener=None, pos=None): if not listener: @@ -381,69 +411,69 @@ self.assertEquals(pos, self.listener.messages[0]['msg_no']) def test_durable_subscription(self): - d = '/topic/durable' - - self.__subscribe(d) + destination = '/topic/durable' + + self.__subscribe(destination) self.__assert_receipt() # send first message without unsubscribing self.listener.reset(1) - self.conn.send("first", destination=d) + self.conn.send(destination, "first") self.__assert_message("first") # now unsubscribe (disconnect only) - self.conn.unsubscribe(id=TestDurableSubscription.ID) + self.unsubscribe_dest(self.conn, destination, TestDurableSubscription.ID) # send again self.listener.reset(2) - self.conn.send("second", destination=d) + self.conn.send(destination, "second") # resubscribe and expect receipt - self.__subscribe(d) + self.__subscribe(destination) self.__assert_receipt(pos=1) # and message self.__assert_message("second", pos=2) # now unsubscribe (cancel) - self.conn.unsubscribe(id=TestDurableSubscription.ID, + self.unsubscribe_dest(self.conn, destination, TestDurableSubscription.ID, headers={'persistent': 'true'}) # send again self.listener.reset(1) - self.conn.send("third", destination=d) + self.conn.send(destination, "third") # resubscribe and expect no message - self.__subscribe(d) + self.__subscribe(destination) self.assertTrue(self.listener.await(3)) self.assertEquals(0, len(self.listener.messages)) self.assertEquals(1, len(self.listener.receipts)) def test_share_subscription(self): - d = '/topic/durable-shared' + destination = '/topic/durable-shared' conn2 = self.create_connection() conn2.set_listener('', self.listener) try: - self.__subscribe(d) + self.__subscribe(destination) self.__assert_receipt() self.listener.reset(1) - self.__subscribe(d, conn2) + self.__subscribe(destination, conn2) self.__assert_receipt() self.listener.reset(100) # send 100 messages for x in xrange(0, 100): - self.conn.send("msg" + str(x), destination=d) + self.conn.send(destination, "msg" + str(x)) self.assertTrue(self.listener.await(5)) self.assertEquals(100, len(self.listener.messages)) finally: - conn2.stop() + conn2.disconnect() def test_separate_ids(self): - d = '/topic/durable-separate' + destination = '/topic/durable-separate' conn2 = self.create_connection() listener2 = base.WaitableListener() @@ -451,36 +481,35 @@ try: # ensure durable subscription exists for each ID - self.__subscribe(d) + self.__subscribe(destination) self.__assert_receipt() - self.__subscribe(d, conn2, "other.id") + self.__subscribe(destination, conn2, "other.id") self.__assert_receipt(listener2) - self.conn.unsubscribe(id=TestDurableSubscription.ID) - conn2.unsubscribe(id="other.id") + self.unsubscribe_dest(self.conn, destination, TestDurableSubscription.ID) + self.unsubscribe_dest(conn2, destination, "other.id") self.listener.reset(101) listener2.reset(101) ## 100 messages and 1 receipt # send 100 messages for x in xrange(0, 100): - self.conn.send("msg" + str(x), destination=d) - - self.__subscribe(d) - self.__subscribe(d, conn2, "other.id") + self.conn.send(destination, "msg" + str(x)) + + self.__subscribe(destination) + self.__subscribe(destination, conn2, "other.id") for l in [self.listener, listener2]: self.assertTrue(l.await(20)) self.assertEquals(100, len(l.messages)) finally: - conn2.stop() + conn2.disconnect() def test_durable_subscribe_no_id(self): - d = '/topic/durable-invalid' - - self.conn.subscribe(destination=d, headers={'persistent':'true'}), + destination = '/topic/durable-invalid' + + self.conn.send_frame('SUBSCRIBE', + {'destination': destination, 'ack': 'auto', 'persistent': 'true'}) self.listener.await(3) self.assertEquals(1, len(self.listener.errors)) self.assertEquals("Missing Header", self.listener.errors[0]['headers']['message']) - - diff --git a/plugins-src/rabbitmq-stomp/test/src/errors.py b/plugins-src/rabbitmq-stomp/test/src/errors.py index 9175429..e52b3ac 100644 --- a/plugins-src/rabbitmq-stomp/test/src/errors.py +++ b/plugins-src/rabbitmq-stomp/test/src/errors.py @@ -28,7 +28,7 @@ def test_unknown_destination(self): self.listener.reset() - self.conn.send(destination="/something/interesting") + self.conn.send("/something/interesting", 'test_unknown_destination') self.assertTrue(self.listener.await()) self.assertEquals(1, len(self.listener.errors)) @@ -54,7 +54,7 @@ def __test_invalid_destination(self, dtype, content): self.listener.reset() - self.conn.send(destination="/" + dtype + content) + self.conn.send("/" + dtype + content, '__test_invalid_destination:' + dtype + content) self.assertTrue(self.listener.await()) self.assertEquals(1, len(self.listener.errors)) diff --git a/plugins-src/rabbitmq-stomp/test/src/lifecycle.py b/plugins-src/rabbitmq-stomp/test/src/lifecycle.py index 902994e..ff9b119 100644 --- a/plugins-src/rabbitmq-stomp/test/src/lifecycle.py +++ b/plugins-src/rabbitmq-stomp/test/src/lifecycle.py @@ -45,6 +45,16 @@ d = "/queue/unsub04" self.unsub_test(d, self.sub_and_send(d, subid="queid", receipt="unsub.rct"), numRcts=1) + def test_connect_version_1_0(self): + ''' Test CONNECT with version 1.0''' + self.conn.disconnect() + new_conn = self.create_connection(version="1.0") + try: + self.assertTrue(new_conn.is_connected()) + finally: + new_conn.disconnect() + self.assertFalse(new_conn.is_connected()) + def test_connect_version_1_1(self): ''' Test CONNECT with version 1.1''' self.conn.disconnect() @@ -55,10 +65,20 @@ new_conn.disconnect() self.assertFalse(new_conn.is_connected()) + def test_connect_version_1_2(self): + ''' Test CONNECT with version 1.2''' + self.conn.disconnect() + new_conn = self.create_connection(version="1.2") + try: + self.assertTrue(new_conn.is_connected()) + finally: + new_conn.disconnect() + self.assertFalse(new_conn.is_connected()) + def test_heartbeat_disconnects_client(self): ''' Test heart-beat disconnection''' self.conn.disconnect() - new_conn = self.create_connection(heartbeat="1500,0") + new_conn = self.create_connection(version='1.1', heartbeats=(1500, 0)) try: self.assertTrue(new_conn.is_connected()) time.sleep(1) @@ -71,37 +91,28 @@ def test_unsupported_version(self): ''' Test unsupported version on CONNECT command''' - self.bad_connect(stomp.Connection(user="guest", - passcode="guest", - version="100.1"), - "Supported versions are 1.0,1.1,1.2\n") + self.bad_connect("Supported versions are 1.0,1.1,1.2\n", version='100.1') def test_bad_username(self): ''' Test bad username''' - self.bad_connect(stomp.Connection(user="gust", - passcode="guest"), - "Access refused for user 'gust'\n") + self.bad_connect("Access refused for user 'gust'\n", user='gust') def test_bad_password(self): ''' Test bad password''' - self.bad_connect(stomp.Connection(user="guest", - passcode="gust"), - "Access refused for user 'guest'\n") + self.bad_connect("Access refused for user 'guest'\n", passcode='gust') def test_bad_vhost(self): ''' Test bad virtual host''' - self.bad_connect(stomp.Connection(user="guest", - passcode="guest", - virtual_host="//"), - "Virtual host '//' access denied") + self.bad_connect("Virtual host '//' access denied", version='1.1', vhost='//') - def bad_connect(self, new_conn, expected): + def bad_connect(self, expected, user='guest', passcode='guest', **kwargs): self.conn.disconnect() + new_conn = self.create_connection_obj(**kwargs) listener = base.WaitableListener() new_conn.set_listener('', listener) try: new_conn.start() - new_conn.connect() + new_conn.connect(user, passcode) self.assertTrue(listener.await()) self.assertEquals(expected, listener.errors[0]['message']) finally: @@ -136,7 +147,7 @@ def unsub_test(self, dest, verbs, numRcts=0): def afterfun(): - self.conn.send("after-test", destination=dest) + self.conn.send(dest, "after-test") subverb, unsubverb = verbs self.assertListenerAfter(subverb, numMsgs=1, errMsg="FAILED to subscribe and send") @@ -145,20 +156,13 @@ self.assertListenerAfter(afterfun, errMsg="Still receiving messages") - def sub_and_send(self, dest, subid="", receipt=""): + def sub_and_send(self, dest, subid=None, receipt=None): def subfun(): - if subid=="": - self.conn.subscribe(destination=dest) - else: - self.conn.subscribe(destination=dest, id=subid) - self.conn.send("test", destination=dest) + self.subscribe_dest(self.conn, dest, subid) + self.conn.send(dest, "test") def unsubfun(): - if subid=="" and receipt=="": - self.conn.unsubscribe(destination=dest) - elif receipt=="": - self.conn.unsubscribe(id=subid) - elif subid=="": - self.conn.unsubscribe(destination=dest, receipt=receipt) - else: - self.conn.unsubscribe(id=subid, receipt=receipt) + headers = {} + if receipt != None: + headers['receipt'] = receipt + self.unsubscribe_dest(self.conn, dest, subid, **headers) return subfun, unsubfun diff --git a/plugins-src/rabbitmq-stomp/test/src/parsing.py b/plugins-src/rabbitmq-stomp/test/src/parsing.py index 58d5bcf..2e08836 100644 --- a/plugins-src/rabbitmq-stomp/test/src/parsing.py +++ b/plugins-src/rabbitmq-stomp/test/src/parsing.py @@ -51,8 +51,8 @@ def match(self, pattern, data): - ''' helper: try to match 'pattern' regexp with 'data' string. - Fail test if they don't match. + ''' helper: try to match a regexp with a string. + Fail test if they do not match. ''' matched = re.match(pattern, data) if matched: @@ -195,47 +195,6 @@ '\n\x00') for cd in [self.cd1, self.cd2]: self.match(resp, cd.recv(4096)) - - - @connect(['cd']) - def test_huge_message(self): - ''' Test sending/receiving huge (16MB) message. ''' - subscribe=( 'SUBSCRIBE\n' - 'id: xxx\n' - 'destination:/exchange/amq.topic/test_huge_message\n' - '\n\0') - self.cd.sendall(subscribe) - - message = 'x' * 1024*1024*16 - - self.cd.sendall('SEND\n' - 'destination:/exchange/amq.topic/test_huge_message\n' - 'content-type:text/plain\n' - '\n' - '%s' - '\0' % message) - - resp=('MESSAGE\n' - 'subscription:(.*)\n' - 'destination:/topic/test_huge_message\n' - 'message-id:(.*)\n' - 'content-type:text/plain\n' - 'content-length:%i\n' - '\n' - '%s(.*)' - % (len(message), message[:8000]) ) - - recv = [] - s = 0 - while len(recv) < 1 or recv[-1][-1] != '\0': - buf = self.cd.recv(4096*16) - s += len(buf) - recv.append( buf ) - buf = ''.join(recv) - - # matching 100MB regexp is way too expensive. - self.match(resp, buf[:8192]) - self.assertEqual(len(buf) > len(message), True) @connect(['cd']) def test_message_with_embedded_nulls(self): diff --git a/plugins-src/rabbitmq-stomp/test/src/rabbit_stomp_amqqueue_test.erl b/plugins-src/rabbitmq-stomp/test/src/rabbit_stomp_amqqueue_test.erl index 013f7cb..42c18ed 100644 --- a/plugins-src/rabbitmq-stomp/test/src/rabbit_stomp_amqqueue_test.erl +++ b/plugins-src/rabbitmq-stomp/test/src/rabbit_stomp_amqqueue_test.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_stomp_amqqueue_test). diff --git a/plugins-src/rabbitmq-stomp/test/src/rabbit_stomp_publish_test.erl b/plugins-src/rabbitmq-stomp/test/src/rabbit_stomp_publish_test.erl index 615c6a7..a67e9aa 100644 --- a/plugins-src/rabbitmq-stomp/test/src/rabbit_stomp_publish_test.erl +++ b/plugins-src/rabbitmq-stomp/test/src/rabbit_stomp_publish_test.erl @@ -34,14 +34,14 @@ run() -> [put(K, 0) || K <- [sent, recd, last_sent, last_recd]], - put(last_ts, erlang:now()), + put(last_ts, os:timestamp()), {ok, Pub} = rabbit_stomp_client:connect(), {ok, Recv} = rabbit_stomp_client:connect(), Self = self(), - spawn(fun() -> publish(Self, Pub, 0, erlang:now()) end), + spawn(fun() -> publish(Self, Pub, 0, os:timestamp()) end), rabbit_stomp_client:send( Recv, "SUBSCRIBE", [{"destination", ?DESTINATION}]), - spawn(fun() -> recv(Self, Recv, 0, erlang:now()) end), + spawn(fun() -> recv(Self, Recv, 0, os:timestamp()) end), report(). report() -> @@ -49,13 +49,13 @@ {sent, C} -> put(sent, C); {recd, C} -> put(recd, C) end, - Diff = timer:now_diff(erlang:now(), get(last_ts)), + Diff = timer:now_diff(os:timestamp(), get(last_ts)), case Diff > ?MICROS_PER_UPDATE of true -> S = get(sent) - get(last_sent), R = get(recd) - get(last_recd), put(last_sent, get(sent)), put(last_recd, get(recd)), - put(last_ts, erlang:now()), + put(last_ts, os:timestamp()), io:format("Send ~p msg/s | Recv ~p msg/s~n", [trunc(S * ?MICROS_PER_SECOND / Diff), trunc(R * ?MICROS_PER_SECOND / Diff)]); @@ -67,10 +67,10 @@ rabbit_stomp_client:send( Client, "SEND", [{"destination", ?DESTINATION}], [integer_to_list(Count)]), - Diff = timer:now_diff(erlang:now(), TS), + Diff = timer:now_diff(os:timestamp(), TS), case Diff > ?MICROS_PER_UPDATE_MSG of true -> Owner ! {sent, Count + 1}, - publish(Owner, Client, Count + 1, erlang:now()); + publish(Owner, Client, Count + 1, os:timestamp()); false -> publish(Owner, Client, Count + 1, TS) end. @@ -79,10 +79,10 @@ rabbit_stomp_client:recv(Client0), BodyInt = list_to_integer(binary_to_list(iolist_to_binary(Body))), Count = BodyInt, - Diff = timer:now_diff(erlang:now(), TS), + Diff = timer:now_diff(os:timestamp(), TS), case Diff > ?MICROS_PER_UPDATE_MSG of true -> Owner ! {recd, Count + 1}, - recv(Owner, Client1, Count + 1, erlang:now()); + recv(Owner, Client1, Count + 1, os:timestamp()); false -> recv(Owner, Client1, Count + 1, TS) end. diff --git a/plugins-src/rabbitmq-stomp/test/src/rabbit_stomp_test.erl b/plugins-src/rabbitmq-stomp/test/src/rabbit_stomp_test.erl index 2fdca2d..2529098 100644 --- a/plugins-src/rabbitmq-stomp/test/src/rabbit_stomp_test.erl +++ b/plugins-src/rabbitmq-stomp/test/src/rabbit_stomp_test.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_stomp_test). @@ -24,16 +24,40 @@ all_tests() -> test_messages_not_dropped_on_disconnect(), + test_direct_client_connections_are_not_leaked(), + ok. + +-define(GARBAGE, <<"bdaf63dda9d78b075c748b740e7c3510ad203b07\nbdaf63dd">>). + +count_connections() -> + length(supervisor2:which_children(rabbit_stomp_client_sup_sup)). + +test_direct_client_connections_are_not_leaked() -> + N = count_connections(), + lists:foreach(fun (_) -> + {ok, Client = {Socket, _}} = rabbit_stomp_client:connect(), + %% send garbage which trips up the parser + gen_tcp:send(Socket, ?GARBAGE), + rabbit_stomp_client:send( + Client, "LOL", [{"", ""}]) + end, + lists:seq(1, 1000)), + timer:sleep(5000), + N = count_connections(), ok. test_messages_not_dropped_on_disconnect() -> + N = count_connections(), {ok, Client} = rabbit_stomp_client:connect(), + N1 = N + 1, + N1 = count_connections(), [rabbit_stomp_client:send( Client, "SEND", [{"destination", ?DESTINATION}], [integer_to_list(Count)]) || Count <- lists:seq(1, 1000)], rabbit_stomp_client:disconnect(Client), QName = rabbit_misc:r(<<"/">>, queue, <<"bulk-test">>), timer:sleep(3000), + N = count_connections(), rabbit_amqqueue:with( QName, fun(Q) -> 1000 = pget(messages, rabbit_amqqueue:info(Q, [messages])) diff --git a/plugins-src/rabbitmq-stomp/test/src/rabbit_stomp_test_frame.erl b/plugins-src/rabbitmq-stomp/test/src/rabbit_stomp_test_frame.erl index 34b7472..a2cbdf3 100644 --- a/plugins-src/rabbitmq-stomp/test/src/rabbit_stomp_test_frame.erl +++ b/plugins-src/rabbitmq-stomp/test/src/rabbit_stomp_test_frame.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_stomp_test_frame). diff --git a/plugins-src/rabbitmq-stomp/test/src/rabbit_stomp_test_util.erl b/plugins-src/rabbitmq-stomp/test/src/rabbit_stomp_test_util.erl index e7459e3..a25e306 100644 --- a/plugins-src/rabbitmq-stomp/test/src/rabbit_stomp_test_util.erl +++ b/plugins-src/rabbitmq-stomp/test/src/rabbit_stomp_test_util.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_stomp_test_util). diff --git a/plugins-src/rabbitmq-stomp/test/src/reliability.py b/plugins-src/rabbitmq-stomp/test/src/reliability.py index 08476d5..b8bb150 100644 --- a/plugins-src/rabbitmq-stomp/test/src/reliability.py +++ b/plugins-src/rabbitmq-stomp/test/src/reliability.py @@ -7,7 +7,7 @@ def test_send_and_disconnect(self): ''' Test close socket after send does not lose messages ''' - d = "/queue/reliability" + destination = "/queue/reliability" pub_conn = self.create_connection() try: msg = "0" * (128) @@ -17,12 +17,12 @@ listener = base.WaitableListener() listener.reset(count) self.conn.set_listener('', listener) - self.conn.subscribe(destination=d) + self.subscribe_dest(self.conn, destination, None) for x in range(0, count): - pub_conn.send(msg + str(x), destination=d) + pub_conn.send(destination, msg + str(x)) time.sleep(2.0) - pub_conn.close_socket() + pub_conn.disconnect() if listener.await(30): self.assertEquals(count, len(listener.messages)) diff --git a/plugins-src/rabbitmq-stomp/test/src/ssl_lifecycle.py b/plugins-src/rabbitmq-stomp/test/src/ssl_lifecycle.py index 7648bf9..53636df 100644 --- a/plugins-src/rabbitmq-stomp/test/src/ssl_lifecycle.py +++ b/plugins-src/rabbitmq-stomp/test/src/ssl_lifecycle.py @@ -5,6 +5,7 @@ import stomp import base +import ssl base_path = os.path.dirname(sys.argv[0]) @@ -16,14 +17,13 @@ class TestSslClient(unittest.TestCase): def __ssl_connect(self): - conn = stomp.Connection(user="guest", passcode="guest", - host_and_ports = [ ('localhost', 61614) ], + conn = stomp.Connection(host_and_ports = [ ('localhost', 61614) ], use_ssl = True, ssl_key_file = ssl_key_file, ssl_cert_file = ssl_cert_file, ssl_ca_certs = ssl_ca_certs) print "FILE: ", ssl_cert_file conn.start() - conn.connect() + conn.connect("guest", "guest") return conn def __ssl_auth_connect(self): @@ -37,11 +37,11 @@ def test_ssl_connect(self): conn = self.__ssl_connect() - conn.stop() + conn.disconnect() def test_ssl_auth_connect(self): conn = self.__ssl_auth_connect() - conn.stop() + conn.disconnect() def test_ssl_send_receive(self): conn = self.__ssl_connect() @@ -58,7 +58,7 @@ conn.set_listener('', listener) d = "/topic/ssl.test" - conn.subscribe(destination=d, receipt="sub") + conn.subscribe(destination=d, ack="auto", id="ctag", receipt="sub") self.assertTrue(listener.await(1)) @@ -66,7 +66,7 @@ listener.receipts[0]['headers']['receipt-id']) listener.reset(1) - conn.send("Hello SSL!", destination=d) + conn.send(body="Hello SSL!", destination=d) self.assertTrue(listener.await()) diff --git a/plugins-src/rabbitmq-stomp/test/src/test.py b/plugins-src/rabbitmq-stomp/test/src/test.py index 4979552..ddeb1fe 100755 --- a/plugins-src/rabbitmq-stomp/test/src/test.py +++ b/plugins-src/rabbitmq-stomp/test/src/test.py @@ -3,7 +3,14 @@ import test_runner if __name__ == '__main__': - modules = ['parsing', 'destinations', 'lifecycle', 'transactions', - 'ack', 'errors', 'reliability'] + modules = [ + 'parsing', + 'destinations', + 'lifecycle', + 'transactions', + 'ack', + 'errors', + 'reliability', + ] test_runner.run_unittests(modules) diff --git a/plugins-src/rabbitmq-stomp/test/src/transactions.py b/plugins-src/rabbitmq-stomp/test/src/transactions.py index 1d95f7e..d4f166b 100644 --- a/plugins-src/rabbitmq-stomp/test/src/transactions.py +++ b/plugins-src/rabbitmq-stomp/test/src/transactions.py @@ -7,14 +7,14 @@ def test_tx_commit(self): ''' Test TX with a COMMIT and ensure messages are delivered ''' - d = "/exchange/amq.fanout" + destination = "/exchange/amq.fanout" tx = "test.tx" self.listener.reset() - self.conn.subscribe(destination=d) + self.subscribe_dest(self.conn, destination, None) self.conn.begin(transaction=tx) - self.conn.send("hello!", destination=d, transaction=tx) - self.conn.send("again!", destination=d) + self.conn.send(destination, "hello!", transaction=tx) + self.conn.send(destination, "again!") ## should see the second message self.assertTrue(self.listener.await(3)) @@ -31,14 +31,14 @@ def test_tx_abort(self): ''' Test TX with an ABORT and ensure messages are discarded ''' - d = "/exchange/amq.fanout" + destination = "/exchange/amq.fanout" tx = "test.tx" self.listener.reset() - self.conn.subscribe(destination=d) + self.subscribe_dest(self.conn, destination, None) self.conn.begin(transaction=tx) - self.conn.send("hello!", destination=d, transaction=tx) - self.conn.send("again!", destination=d) + self.conn.send(destination, "hello!", transaction=tx) + self.conn.send(destination, "again!") ## should see the second message self.assertTrue(self.listener.await(3)) diff --git a/plugins-src/rabbitmq-test/test/src/rabbit_priority_queue_test.erl b/plugins-src/rabbitmq-test/test/src/rabbit_priority_queue_test.erl index e348db3..44228ff 100644 --- a/plugins-src/rabbitmq-test/test/src/rabbit_priority_queue_test.erl +++ b/plugins-src/rabbitmq-test/test/src/rabbit_priority_queue_test.erl @@ -205,10 +205,10 @@ Q = Q0#amqqueue{arguments = [{<<"x-max-priority">>, long, 5}]}, PQ = rabbit_priority_queue, BQS1 = PQ:init(Q, new, fun(_, _) -> ok end), - {Duration1, BQS2} = PQ:ram_duration(BQS1), + {_Duration1, BQS2} = PQ:ram_duration(BQS1), BQS3 = PQ:set_ram_duration_target(infinity, BQS2), BQS4 = PQ:set_ram_duration_target(1, BQS3), - {Duration2, BQS5} = PQ:ram_duration(BQS4), + {_Duration2, BQS5} = PQ:ram_duration(BQS4), PQ:delete_and_terminate(a_whim, BQS5), passed. diff --git a/plugins-src/rabbitmq-tracing/src/rabbit_tracing_app.erl b/plugins-src/rabbitmq-tracing/src/rabbit_tracing_app.erl index bfa249f..815855b 100644 --- a/plugins-src/rabbitmq-tracing/src/rabbit_tracing_app.erl +++ b/plugins-src/rabbitmq-tracing/src/rabbit_tracing_app.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_tracing_app). diff --git a/plugins-src/rabbitmq-tracing/src/rabbit_tracing_consumer.erl b/plugins-src/rabbitmq-tracing/src/rabbit_tracing_consumer.erl index 1cad7da..ca2273b 100644 --- a/plugins-src/rabbitmq-tracing/src/rabbit_tracing_consumer.erl +++ b/plugins-src/rabbitmq-tracing/src/rabbit_tracing_consumer.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Federation. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_tracing_consumer). diff --git a/plugins-src/rabbitmq-tracing/src/rabbit_tracing_consumer_sup.erl b/plugins-src/rabbitmq-tracing/src/rabbit_tracing_consumer_sup.erl index 10289a6..8dbc22f 100644 --- a/plugins-src/rabbitmq-tracing/src/rabbit_tracing_consumer_sup.erl +++ b/plugins-src/rabbitmq-tracing/src/rabbit_tracing_consumer_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ Federation. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_tracing_consumer_sup). diff --git a/plugins-src/rabbitmq-tracing/src/rabbit_tracing_files.erl b/plugins-src/rabbitmq-tracing/src/rabbit_tracing_files.erl index 2005fdf..c5520e7 100644 --- a/plugins-src/rabbitmq-tracing/src/rabbit_tracing_files.erl +++ b/plugins-src/rabbitmq-tracing/src/rabbit_tracing_files.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_tracing_files). diff --git a/plugins-src/rabbitmq-tracing/src/rabbit_tracing_mgmt.erl b/plugins-src/rabbitmq-tracing/src/rabbit_tracing_mgmt.erl index 25a4bd8..3d2d44d 100644 --- a/plugins-src/rabbitmq-tracing/src/rabbit_tracing_mgmt.erl +++ b/plugins-src/rabbitmq-tracing/src/rabbit_tracing_mgmt.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_tracing_mgmt). diff --git a/plugins-src/rabbitmq-tracing/src/rabbit_tracing_sup.erl b/plugins-src/rabbitmq-tracing/src/rabbit_tracing_sup.erl index e0f352e..502ef7e 100644 --- a/plugins-src/rabbitmq-tracing/src/rabbit_tracing_sup.erl +++ b/plugins-src/rabbitmq-tracing/src/rabbit_tracing_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_tracing_sup). diff --git a/plugins-src/rabbitmq-tracing/src/rabbit_tracing_traces.erl b/plugins-src/rabbitmq-tracing/src/rabbit_tracing_traces.erl index 7fc7c14..53336d7 100644 --- a/plugins-src/rabbitmq-tracing/src/rabbit_tracing_traces.erl +++ b/plugins-src/rabbitmq-tracing/src/rabbit_tracing_traces.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_tracing_traces). diff --git a/plugins-src/rabbitmq-tracing/src/rabbit_tracing_wm_file.erl b/plugins-src/rabbitmq-tracing/src/rabbit_tracing_wm_file.erl index 4d67f73..30a134b 100644 --- a/plugins-src/rabbitmq-tracing/src/rabbit_tracing_wm_file.erl +++ b/plugins-src/rabbitmq-tracing/src/rabbit_tracing_wm_file.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. -module(rabbit_tracing_wm_file). diff --git a/plugins-src/rabbitmq-tracing/src/rabbit_tracing_wm_files.erl b/plugins-src/rabbitmq-tracing/src/rabbit_tracing_wm_files.erl index b19cfba..d3a8004 100644 --- a/plugins-src/rabbitmq-tracing/src/rabbit_tracing_wm_files.erl +++ b/plugins-src/rabbitmq-tracing/src/rabbit_tracing_wm_files.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_tracing_wm_files). diff --git a/plugins-src/rabbitmq-tracing/src/rabbit_tracing_wm_trace.erl b/plugins-src/rabbitmq-tracing/src/rabbit_tracing_wm_trace.erl index c0cbaf9..a9cdbac 100644 --- a/plugins-src/rabbitmq-tracing/src/rabbit_tracing_wm_trace.erl +++ b/plugins-src/rabbitmq-tracing/src/rabbit_tracing_wm_trace.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. -module(rabbit_tracing_wm_trace). diff --git a/plugins-src/rabbitmq-tracing/src/rabbit_tracing_wm_traces.erl b/plugins-src/rabbitmq-tracing/src/rabbit_tracing_wm_traces.erl index 9f42355..ef0fe50 100644 --- a/plugins-src/rabbitmq-tracing/src/rabbit_tracing_wm_traces.erl +++ b/plugins-src/rabbitmq-tracing/src/rabbit_tracing_wm_traces.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_tracing_wm_traces). diff --git a/plugins-src/rabbitmq-tracing/test/src/rabbit_tracing_test.erl b/plugins-src/rabbitmq-tracing/test/src/rabbit_tracing_test.erl index 4cce6eb..df184eb 100644 --- a/plugins-src/rabbitmq-tracing/test/src/rabbit_tracing_test.erl +++ b/plugins-src/rabbitmq-tracing/test/src/rabbit_tracing_test.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_tracing_test). diff --git a/plugins-src/rabbitmq-web-stomp/test/src/stomp.erl b/plugins-src/rabbitmq-web-stomp/test/src/stomp.erl index a23e2fd..710a7f6 100644 --- a/plugins-src/rabbitmq-web-stomp/test/src/stomp.erl +++ b/plugins-src/rabbitmq-web-stomp/test/src/stomp.erl @@ -30,7 +30,7 @@ [Head, Body] = binary:split(Frame, <<"\n\n">>), [Command | HeaderLines] = binary:split(Head, <<"\n">>, [global]), Headers = [list_to_tuple(binary:split(Line, <<":">>)) || Line <- HeaderLines], - [Body1, <<>>] = binary:split(Body, [<<0>>],[{scope,{byte_size(Body)-1, 1}}]), + [Body1, <<>>] = binary:split(Body, [<<0, 10>>],[{scope,{byte_size(Body)-2, 2}}]), {Command, Headers, Body1}. %% ---------- diff --git a/scripts/rabbitmq-defaults b/scripts/rabbitmq-defaults index 1d9afbd..26f6af7 100755 --- a/scripts/rabbitmq-defaults +++ b/scripts/rabbitmq-defaults @@ -12,7 +12,7 @@ ## The Original Code is RabbitMQ. ## ## The Initial Developer of the Original Code is GoPivotal, Inc. -## Copyright (c) 2012-2014 GoPivotal, Inc. All rights reserved. +## Copyright (c) 2012-2015 Pivotal Software, Inc. All rights reserved. ## ### next line potentially updated in package install steps @@ -26,11 +26,14 @@ ## Set default values +BOOT_MODULE="rabbit" + CONFIG_FILE=${SYS_PREFIX}/etc/rabbitmq/rabbitmq LOG_BASE=${SYS_PREFIX}/var/log/rabbitmq MNESIA_BASE=${SYS_PREFIX}/var/lib/rabbitmq/mnesia ENABLED_PLUGINS_FILE=${SYS_PREFIX}/etc/rabbitmq/enabled_plugins PLUGINS_DIR="${RABBITMQ_HOME}/plugins" +IO_THREAD_POOL_SIZE=64 CONF_ENV_FILE=${SYS_PREFIX}/etc/rabbitmq/rabbitmq-env.conf diff --git a/scripts/rabbitmq-defaults.bat b/scripts/rabbitmq-defaults.bat new file mode 100755 index 0000000..d3983f2 --- /dev/null +++ b/scripts/rabbitmq-defaults.bat @@ -0,0 +1,37 @@ +@echo off + +REM ### next line potentially updated in package install steps +REM set SYS_PREFIX= + +REM ### next line will be updated when generating a standalone release +REM ERL_DIR= +set ERL_DIR= + +REM These boot files don't appear to be referenced in the batch scripts +REM set CLEAN_BOOT_FILE=start_clean +REM set SASL_BOOT_FILE=start_sasl + +REM ## Set default values + +if "!RABBITMQ_BASE!"=="" ( + set RABBITMQ_BASE=!APPDATA!\RabbitMQ +) + +REM BOOT_MODULE="rabbit" +REM CONFIG_FILE=${SYS_PREFIX}/etc/rabbitmq/rabbitmq +REM LOG_BASE=${SYS_PREFIX}/var/log/rabbitmq +REM MNESIA_BASE=${SYS_PREFIX}/var/lib/rabbitmq/mnesia +REM ENABLED_PLUGINS_FILE=${SYS_PREFIX}/etc/rabbitmq/enabled_plugins +set BOOT_MODULE=rabbit +set CONFIG_FILE=!RABBITMQ_BASE!\rabbitmq +set LOG_BASE=!RABBITMQ_BASE!\log +set MNESIA_BASE=!RABBITMQ_BASE!\db +set ENABLED_PLUGINS_FILE=!RABBITMQ_BASE!\enabled_plugins + +REM PLUGINS_DIR="${RABBITMQ_HOME}/plugins" +set PLUGINS_DIR=!TDP0!..\plugins + +REM CONF_ENV_FILE=${SYS_PREFIX}/etc/rabbitmq/rabbitmq-env.conf +if "!RABBITMQ_CONF_ENV_FILE!"=="" ( + set CONF_ENV_FILE=!APPDATA!\RabbitMQ\rabbitmq-env-conf.bat +) diff --git a/scripts/rabbitmq-echopid.bat b/scripts/rabbitmq-echopid.bat index 2d3a6fa..6262a16 100755 --- a/scripts/rabbitmq-echopid.bat +++ b/scripts/rabbitmq-echopid.bat @@ -5,6 +5,12 @@ REM (s)name of the erlang node to connect to (required) setlocal + +set TDP0=%~dp0 + +REM Get default settings with user overrides for (RABBITMQ_) +REM Non-empty defaults should be set in rabbitmq-env +call "!TDP0!\rabbitmq-env.bat" if "%1"=="" goto fail @@ -17,16 +23,6 @@ if not exist "%WMIC_PATH%" ( goto fail ) - -:: sets sname/name :: -if "!RABBITMQ_USE_LONGNAME!"=="" ( - set RABBITMQ_NAME_TYPE="-sname" -) - -if "!RABBITMQ_USE_LONGNAME!"=="true" ( - set RABBITMQ_NAME_TYPE="-name" -) - :getpid for /f "usebackq tokens=* skip=1" %%P IN (`%%WMIC_PATH%% process where "name='erl.exe' and commandline like '%%%RABBITMQ_NAME_TYPE% %1%%'" get processid 2^>nul`) do ( diff --git a/scripts/rabbitmq-env b/scripts/rabbitmq-env index 8a1b4d6..a5bf52a 100755 --- a/scripts/rabbitmq-env +++ b/scripts/rabbitmq-env @@ -12,7 +12,7 @@ ## The Original Code is RabbitMQ. ## ## The Initial Developer of the Original Code is GoPivotal, Inc. -## Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +## Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. ## # We set +e here since since our test for "readlink -f" below needs to @@ -44,8 +44,7 @@ . ${SCRIPT_DIR}/rabbitmq-defaults ## Common defaults -SERVER_ERL_ARGS="+K true +A30 +P 1048576 \ - -kernel inet_default_connect_options [{nodelay,true}]" +SERVER_ERL_ARGS="+P 1048576" # warn about old rabbitmq.conf file, if no new one if [ -f /etc/rabbitmq/rabbitmq.conf ] && \ @@ -54,8 +53,23 @@ echo "location has moved to ${CONF_ENV_FILE}" fi +# We save the current value of $RABBITMQ_PID_FILE in case it was set by +# an init script. If $CONF_ENV_FILE overrides it again, we must ignore +# it and warn the user. +saved_RABBITMQ_PID_FILE=$RABBITMQ_PID_FILE + ## Get configuration variables from the configure environment file [ -f ${CONF_ENV_FILE} ] && . ${CONF_ENV_FILE} || true + +if [ "$saved_RABBITMQ_PID_FILE" -a \ + "$saved_RABBITMQ_PID_FILE" != "$RABBITMQ_PID_FILE" ]; then + echo "WARNING: RABBITMQ_PID_FILE was already set by the init script to:" 1>&2 + echo " $saved_RABBITMQ_PID_FILE" 1>&2 + echo " The value set in rabbitmq-env.conf is ignored because it" 1>&2 + echo " would break the init script." 1>&2 + + RABBITMQ_PID_FILE="$saved_RABBITMQ_PID_FILE" +fi [ "x" = "x$RABBITMQ_USE_LONGNAME" ] && RABBITMQ_USE_LONGNAME=${USE_LONGNAME} if [ "xtrue" = "x$RABBITMQ_USE_LONGNAME" ] ; then @@ -70,6 +84,48 @@ ##--- Set environment vars RABBITMQ_ to defaults if not set +rmq_realpath() { + local path=$1 + + if [ -d "$path" ]; then + cd "$path" && pwd + elif [ -f "$path" ]; then + cd "$(dirname "$path")" && echo $(pwd)/$(basename "$path") + else + echo "$path" + fi +} + +rmq_check_if_shared_with_mnesia() { + local var + + local mnesia_dir=$(rmq_realpath "${RABBITMQ_MNESIA_DIR}") + local prefix="WARNING:" + + for var in "$@"; do + local dir=$(eval "echo \"\$$var\"") + + case $(rmq_realpath "$dir") in + ${mnesia_dir}) + warning=1 + echo "$prefix $var is equal to RABBITMQ_MNESIA_DIR" 1>&2 + ;; + ${mnesia_dir}/*) + warning=1 + echo "$prefix $var is located inside RABBITMQ_MNESIA_DIR" 1>&2 + ;; + esac + + if [ "x$warning" = "x1" ]; then + prefix=" " + fi + done + + if [ "x$warning" = "x1" ]; then + echo "$prefix => Auto-clustering will not work ('cluster_nodes' in rabbitmq.config)" 1>&2 + fi +} + DEFAULT_NODE_IP_ADDRESS=auto DEFAULT_NODE_PORT=5672 [ "x" = "x$RABBITMQ_NODE_IP_ADDRESS" ] && RABBITMQ_NODE_IP_ADDRESS=${NODE_IP_ADDRESS} @@ -83,6 +139,7 @@ [ "x" = "x$RABBITMQ_DIST_PORT" ] && [ "x" != "x$RABBITMQ_NODE_PORT" ] && RABBITMQ_DIST_PORT=$((${RABBITMQ_NODE_PORT} + 20000)) [ "x" = "x$RABBITMQ_NODENAME" ] && RABBITMQ_NODENAME=${NODENAME} +[ "x" = "x$RABBITMQ_IO_THREAD_POOL_SIZE" ] && RABBITMQ_IO_THREAD_POOL_SIZE=${IO_THREAD_POOL_SIZE} [ "x" = "x$RABBITMQ_SERVER_ERL_ARGS" ] && RABBITMQ_SERVER_ERL_ARGS=${SERVER_ERL_ARGS} [ "x" = "x$RABBITMQ_CONFIG_FILE" ] && RABBITMQ_CONFIG_FILE=${CONFIG_FILE} [ "x" = "x$RABBITMQ_LOG_BASE" ] && RABBITMQ_LOG_BASE=${LOG_BASE} @@ -94,6 +151,8 @@ [ "x" = "x$RABBITMQ_PID_FILE" ] && RABBITMQ_PID_FILE=${PID_FILE} [ "x" = "x$RABBITMQ_PID_FILE" ] && RABBITMQ_PID_FILE=${RABBITMQ_MNESIA_DIR}.pid + +[ "x" = "x$RABBITMQ_BOOT_MODULE" ] && RABBITMQ_BOOT_MODULE=${BOOT_MODULE} [ "x" = "x$RABBITMQ_PLUGINS_EXPAND_DIR" ] && RABBITMQ_PLUGINS_EXPAND_DIR=${PLUGINS_EXPAND_DIR} [ "x" = "x$RABBITMQ_PLUGINS_EXPAND_DIR" ] && RABBITMQ_PLUGINS_EXPAND_DIR=${RABBITMQ_MNESIA_BASE}/${RABBITMQ_NODENAME}-plugins-expand @@ -110,6 +169,21 @@ [ "x" = "x$RABBITMQ_CTL_ERL_ARGS" ] && RABBITMQ_CTL_ERL_ARGS=${CTL_ERL_ARGS} +# Check if files and directories non-related to Mnesia are configured +# to be in $RABBITMQ_MNESIA_DIR. If this is the case, issue a warning +# because it will prevent auto-clustering from working (the node will be +# considered non-virgin). + +rmq_check_if_shared_with_mnesia \ + RABBITMQ_CONFIG_FILE \ + RABBITMQ_LOG_BASE \ + RABBITMQ_PID_FILE \ + RABBITMQ_PLUGINS_EXPAND_DIR \ + RABBITMQ_ENABLED_PLUGINS_FILE \ + RABBITMQ_PLUGINS_DIR \ + RABBITMQ_LOGS \ + RABBITMQ_SASL_LOGS + ##--- End of overridden variables # Since we source this elsewhere, don't accidentally stop execution diff --git a/scripts/rabbitmq-env.bat b/scripts/rabbitmq-env.bat new file mode 100755 index 0000000..8657f1e --- /dev/null +++ b/scripts/rabbitmq-env.bat @@ -0,0 +1,252 @@ +@echo off + +REM Scopes the variables to the current batch file +REM setlocal + +rem Preserve values that might contain exclamation marks before +rem enabling delayed expansion +set TDP0=%~dp0 +REM setlocal enabledelayedexpansion + +REM SCRIPT_DIR=`dirname $SCRIPT_PATH` +REM RABBITMQ_HOME="${SCRIPT_DIR}/.." +set SCRIPT_DIR=%TDP0% +set RABBITMQ_HOME=%SCRIPT_DIR%.. + +REM ## Set defaults +REM . ${SCRIPT_DIR}/rabbitmq-defaults +call "%SCRIPT_DIR%\rabbitmq-defaults.bat" + +REM These common defaults aren't referenced in the batch scripts +REM ## Common defaults +REM SERVER_ERL_ARGS="+P 1048576" +REM +REM # warn about old rabbitmq.conf file, if no new one +REM if [ -f /etc/rabbitmq/rabbitmq.conf ] && \ +REM [ ! -f ${CONF_ENV_FILE} ] ; then +REM echo -n "WARNING: ignoring /etc/rabbitmq/rabbitmq.conf -- " +REM echo "location has moved to ${CONF_ENV_FILE}" +REM fi + +REM ERL_ARGS aren't referenced in the batch scripts +REM Common defaults +REM set SERVER_ERL_ARGS=+P 1048576 + +REM ## Get configuration variables from the configure environment file +REM [ -f ${CONF_ENV_FILE} ] && . ${CONF_ENV_FILE} || true +if exist "!RABBITMQ_CONF_ENV_FILE!" ( + call !RABBITMQ_CONF_ENV_FILE! +) + +REM Check for the short names here too +if "!RABBITMQ_USE_LONGNAME!"=="" ( + if "!USE_LONGNAME!"=="" ( + set RABBITMQ_NAME_TYPE="-sname" + ) +) + +if "!RABBITMQ_USE_LONGNAME!"=="true" ( + if "!USE_LONGNAME!"=="true" ( + set RABBITMQ_NAME_TYPE="-name" + ) +) + +if "!COMPUTERNAME!"=="" ( + set COMPUTERNAME=localhost +) + +REM [ "x" = "x$RABBITMQ_NODENAME" ] && RABBITMQ_NODENAME=${NODENAME} +if "!RABBITMQ_NODENAME!"=="" ( + if "!NODENAME!"=="" ( + set RABBITMQ_NODENAME=rabbit@!COMPUTERNAME! + ) else ( + set RABBITMQ_NODENAME=!NODENAME! + ) +) + +REM +REM ##--- Set environment vars RABBITMQ_ to defaults if not set +REM +REM DEFAULT_NODE_IP_ADDRESS=auto +REM DEFAULT_NODE_PORT=5672 +REM [ "x" = "x$RABBITMQ_NODE_IP_ADDRESS" ] && RABBITMQ_NODE_IP_ADDRESS=${NODE_IP_ADDRESS} +REM [ "x" = "x$RABBITMQ_NODE_PORT" ] && RABBITMQ_NODE_PORT=${NODE_PORT} +REM [ "x" = "x$RABBITMQ_NODE_IP_ADDRESS" ] && [ "x" != "x$RABBITMQ_NODE_PORT" ] && RABBITMQ_NODE_IP_ADDRESS=${DEFAULT_NODE_IP_ADDRESS} +REM [ "x" != "x$RABBITMQ_NODE_IP_ADDRESS" ] && [ "x" = "x$RABBITMQ_NODE_PORT" ] && RABBITMQ_NODE_PORT=${DEFAULT_NODE_PORT} + +REM if "!RABBITMQ_NODE_IP_ADDRESS!"=="" ( +REM if not "!RABBITMQ_NODE_PORT!"=="" ( +REM set RABBITMQ_NODE_IP_ADDRESS=auto +REM ) +REM ) else ( +REM if "!RABBITMQ_NODE_PORT!"=="" ( +REM set RABBITMQ_NODE_PORT=5672 +REM ) +REM ) + +REM DOUBLE CHECK THIS LOGIC +if "!RABBITMQ_NODE_IP_ADDRESS!"=="" ( + if "!NODE_IP_ADDRESS!"=="" ( + set RABBITMQ_NODE_IP_ADDRESS=auto + ) else ( + set RABBITMQ_NODE_IP_ADDRESS=!NODE_IP_ADDRESS! + ) +) + +if "!RABBITMQ_NODE_PORT!"=="" ( + if "!NODE_PORT!"=="" ( + set RABBITMQ_NODE_PORT=5672 + ) else ( + set RABBITMQ_NODE_PORT=!NODE_PORT! + ) +) + +REM [ "x" = "x$RABBITMQ_DIST_PORT" ] && RABBITMQ_DIST_PORT=${DIST_PORT} +REM [ "x" = "x$RABBITMQ_DIST_PORT" ] && [ "x" = "x$RABBITMQ_NODE_PORT" ] && RABBITMQ_DIST_PORT=$((${DEFAULT_NODE_PORT} + 20000)) +REM [ "x" = "x$RABBITMQ_DIST_PORT" ] && [ "x" != "x$RABBITMQ_NODE_PORT" ] && RABBITMQ_DIST_PORT=$((${RABBITMQ_NODE_PORT} + 20000)) + +if "!RABBITMQ_DIST_PORT!"=="" ( + if "!DIST_PORT!"=="" ( + if "!RABBITMQ_NODE_PORT!"=="" ( + set RABBITMQ_DIST_PORT=25672 + ) else ( + set /a RABBITMQ_DIST_PORT=20000+!RABBITMQ_NODE_PORT! + ) + ) else ( + set RABBITMQ_DIST_PORT=!DIST_PORT! + ) +) + +REM [ "x" = "x$RABBITMQ_SERVER_ERL_ARGS" ] && RABBITMQ_SERVER_ERL_ARGS=${SERVER_ERL_ARGS} +REM No Windows equivalent + +REM [ "x" = "x$RABBITMQ_CONFIG_FILE" ] && RABBITMQ_CONFIG_FILE=${CONFIG_FILE} +if "!RABBITMQ_CONFIG_FILE!"=="" ( + if "!CONFIG_FILE!"=="" ( + set RABBITMQ_CONFIG_FILE=!RABBITMQ_BASE!\rabbitmq + ) else ( + set RABBITMQ_CONFIG_FILE=!CONFIG_FILE! + ) +) + +REM [ "x" = "x$RABBITMQ_LOG_BASE" ] && RABBITMQ_LOG_BASE=${LOG_BASE} +if "!RABBITMQ_LOG_BASE!"=="" ( + if "!LOG_BASE!"=="" ( + set RABBITMQ_LOG_BASE=!RABBITMQ_BASE!\log + ) else ( + set RABBITMQ_LOG_BASE=!LOG_BASE! + ) +) + +REM [ "x" = "x$RABBITMQ_MNESIA_BASE" ] && RABBITMQ_MNESIA_BASE=${MNESIA_BASE} +if "!RABBITMQ_MNESIA_BASE!"=="" ( + if "!MNESIA_BASE!"=="" ( + set RABBITMQ_MNESIA_BASE=!RABBITMQ_BASE!\db + ) else ( + set RABBITMQ_MNESIA_BASE=!MNESIA_BASE! + ) +) + +REM [ "x" = "x$RABBITMQ_SERVER_START_ARGS" ] && RABBITMQ_SERVER_START_ARGS=${SERVER_START_ARGS} +REM No Windows equivalent + +REM [ "x" = "x$RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS" ] && RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS=${SERVER_ADDITIONAL_ERL_ARGS} +REM No Windows equivalent + +REM [ "x" = "x$RABBITMQ_MNESIA_DIR" ] && RABBITMQ_MNESIA_DIR=${MNESIA_DIR} +REM [ "x" = "x$RABBITMQ_MNESIA_DIR" ] && RABBITMQ_MNESIA_DIR=${RABBITMQ_MNESIA_BASE}/${RABBITMQ_NODENAME} +if "!RABBITMQ_MNESIA_DIR!"=="" ( + if "!MNESIA_DIR!"=="" ( + set RABBITMQ_MNESIA_DIR=!RABBITMQ_MNESIA_BASE!/!RABBITMQ_NODENAME!-mnesia + ) else ( + set RABBITMQ_MNESIA_DIR=!MNESIA_DIR! + ) +) + +REM [ "x" = "x$RABBITMQ_PID_FILE" ] && RABBITMQ_PID_FILE=${PID_FILE} +REM [ "x" = "x$RABBITMQ_PID_FILE" ] && RABBITMQ_PID_FILE=${RABBITMQ_MNESIA_DIR}.pid +REM No Windows equivalent + +REM [ "x" = "x$RABBITMQ_BOOT_MODULE" ] && RABBITMQ_BOOT_MODULE=${BOOT_MODULE} +if "!RABBITMQ_BOOT_MODULE!"=="" ( + if "!BOOT_MODULE!"=="" ( + set RABBITMQ_BOOT_MODULE=rabbit + ) else ( + set RABBITMQ_BOOT_MODULE=!BOOT_MODULE! + ) +) + +REM [ "x" = "x$RABBITMQ_PLUGINS_EXPAND_DIR" ] && RABBITMQ_PLUGINS_EXPAND_DIR=${PLUGINS_EXPAND_DIR} +REM [ "x" = "x$RABBITMQ_PLUGINS_EXPAND_DIR" ] && RABBITMQ_PLUGINS_EXPAND_DIR=${RABBITMQ_MNESIA_BASE}/${RABBITMQ_NODENAME}-plugins-expand +if "!RABBITMQ_PLUGINS_EXPAND_DIR!"=="" ( + if "!PLUGINS_EXPAND_DIR!"=="" ( + set RABBITMQ_PLUGINS_EXPAND_DIR=!RABBITMQ_MNESIA_BASE!/!RABBITMQ_NODENAME!-plugins-expand + ) else ( + set RABBITMQ_PLUGINS_EXPAND_DIR=!PLUGINS_EXPAND_DIR! + ) +) + +REM [ "x" = "x$RABBITMQ_ENABLED_PLUGINS_FILE" ] && RABBITMQ_ENABLED_PLUGINS_FILE=${ENABLED_PLUGINS_FILE} +if "!RABBITMQ_ENABLED_PLUGINS_FILE!"=="" ( + if "!ENABLED_PLUGINS_FILE!"=="" ( + set RABBITMQ_ENABLED_PLUGINS_FILE=!RABBITMQ_BASE!\enabled_plugins + ) else ( + set RABBITMQ_ENABLED_PLUGINS_FILE=!ENABLED_PLUGINS_FILE! + ) +) + +REM [ "x" = "x$RABBITMQ_PLUGINS_DIR" ] && RABBITMQ_PLUGINS_DIR=${PLUGINS_DIR} +if "!RABBITMQ_PLUGINS_DIR!"=="" ( + if "!PLUGINS_DIR!"=="" ( + set RABBITMQ_PLUGINS_DIR=!RABBITMQ_BASE!\plugins + ) else ( + set RABBITMQ_PLUGINS_DIR=!PLUGINS_DIR! + ) +) + +REM ## Log rotation +REM [ "x" = "x$RABBITMQ_LOGS" ] && RABBITMQ_LOGS=${LOGS} +REM [ "x" = "x$RABBITMQ_LOGS" ] && RABBITMQ_LOGS="${RABBITMQ_LOG_BASE}/${RABBITMQ_NODENAME}.log" +if "!RABBITMQ_LOGS!"=="" ( + if "!LOGS!"=="" ( + set LOGS=!RABBITMQ_LOG_BASE!\!RABBITMQ_NODENAME!.log + ) else ( + set LOGS=!LOGS! + ) +) + +REM [ "x" = "x$RABBITMQ_SASL_LOGS" ] && RABBITMQ_SASL_LOGS=${SASL_LOGS} +REM [ "x" = "x$RABBITMQ_SASL_LOGS" ] && RABBITMQ_SASL_LOGS="${RABBITMQ_LOG_BASE}/${RABBITMQ_NODENAME}-sasl.log" +if "!RABBITMQ_SASL_LOGS!"=="" ( + if "!SASL_LOGS!"=="" ( + set SASL_LOGS=!RABBITMQ_LOG_BASE!\!RABBITMQ_NODENAME!-sasl.log + ) else ( + set SASL_LOGS=!SASL_LOGS! + ) +) + +REM [ "x" = "x$RABBITMQ_CTL_ERL_ARGS" ] && RABBITMQ_CTL_ERL_ARGS=${CTL_ERL_ARGS} +if "!$RABBITMQ_CTL_ERL_ARGS!"=="" ( + if not "!CTL_ERL_ARGS!"=="" ( + set RABBITMQ_CTL_ERL_ARGS=!CTL_ERL_ARGS! + ) +) + +REM ADDITIONAL WINDOWS ONLY CONFIG ITEMS +REM rabbitmq-plugins.bat +REM if "!RABBITMQ_SERVICENAME!"=="" ( +REM set RABBITMQ_SERVICENAME=RabbitMQ +REM ) + +if "!RABBITMQ_SERVICENAME!"=="" ( + if "!SERVICENAME!"=="" ( + set RABBITMQ_SERVICENAME=RabbitMQ + ) else ( + set RABBITMQ_SERVICENAME=!SERVICENAME! + ) +) + +REM ##--- End of overridden variables +REM +REM # Since we source this elsewhere, don't accidentally stop execution +REM true diff --git a/scripts/rabbitmq-plugins b/scripts/rabbitmq-plugins index d595620..fb88bcc 100755 --- a/scripts/rabbitmq-plugins +++ b/scripts/rabbitmq-plugins @@ -12,7 +12,7 @@ ## The Original Code is RabbitMQ. ## ## The Initial Developer of the Original Code is GoPivotal, Inc. -## Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +## Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. ## # Get default settings with user overrides for (RABBITMQ_) diff --git a/scripts/rabbitmq-plugins.bat b/scripts/rabbitmq-plugins.bat index 01a64c9..6fb2f4f 100755 --- a/scripts/rabbitmq-plugins.bat +++ b/scripts/rabbitmq-plugins.bat @@ -1,4 +1,5 @@ @echo off + REM The contents of this file are subject to the Mozilla Public License REM Version 1.1 (the "License"); you may not use this file except in REM compliance with the License. You may obtain a copy of the License @@ -12,7 +13,7 @@ REM The Original Code is RabbitMQ. REM REM The Initial Developer of the Original Code is GoPivotal, Inc. -REM Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +REM Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. REM setlocal @@ -23,17 +24,9 @@ set STAR=%* setlocal enabledelayedexpansion -if "!RABBITMQ_SERVICENAME!"=="" ( - set RABBITMQ_SERVICENAME=RabbitMQ -) - -if "!RABBITMQ_BASE!"=="" ( - set RABBITMQ_BASE=!APPDATA!\!RABBITMQ_SERVICENAME! -) - -if "!RABBITMQ_NODENAME!"=="" ( - set RABBITMQ_NODENAME=rabbit@!COMPUTERNAME! -) +REM Get default settings with user overrides for (RABBITMQ_) +REM Non-empty defaults should be set in rabbitmq-env +call "!TDP0!\rabbitmq-env.bat" if not exist "!ERLANG_HOME!\bin\erl.exe" ( echo. @@ -45,14 +38,6 @@ echo RabbitMQ server distribution in the Erlang lib folder. echo. exit /B 1 -) - -if "!RABBITMQ_ENABLED_PLUGINS_FILE!"=="" ( - set RABBITMQ_ENABLED_PLUGINS_FILE=!RABBITMQ_BASE!\enabled_plugins -) - -if "!RABBITMQ_PLUGINS_DIR!"=="" ( - set RABBITMQ_PLUGINS_DIR=!TDP0!..\plugins ) "!ERLANG_HOME!\bin\erl.exe" ^ diff --git a/scripts/rabbitmq-server b/scripts/rabbitmq-server index aea8bfc..1800b87 100755 --- a/scripts/rabbitmq-server +++ b/scripts/rabbitmq-server @@ -12,7 +12,7 @@ ## The Original Code is RabbitMQ. ## ## The Initial Developer of the Original Code is GoPivotal, Inc. -## Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +## Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. ## # Get default settings with user overrides for (RABBITMQ_) @@ -21,7 +21,7 @@ RABBITMQ_START_RABBIT= [ "x" = "x$RABBITMQ_ALLOW_INPUT" ] && RABBITMQ_START_RABBIT=" -noinput" -[ "x" = "x$RABBITMQ_NODE_ONLY" ] && RABBITMQ_START_RABBIT="$RABBITMQ_START_RABBIT -s rabbit boot " +[ "x" = "x$RABBITMQ_NODE_ONLY" ] && RABBITMQ_START_RABBIT="$RABBITMQ_START_RABBIT -s $RABBITMQ_BOOT_MODULE boot " case "$(uname -s)" in CYGWIN*) # we make no attempt to record the cygwin pid; rabbitmqctl wait @@ -76,6 +76,24 @@ RABBITMQ_LISTEN_ARG= [ "x" != "x$RABBITMQ_NODE_PORT" ] && [ "x" != "x$RABBITMQ_NODE_IP_ADDRESS" ] && RABBITMQ_LISTEN_ARG="-rabbit tcp_listeners [{\""${RABBITMQ_NODE_IP_ADDRESS}"\","${RABBITMQ_NODE_PORT}"}]" +# If $RABBITMQ_LOGS is '-', send all log messages to stdout. Likewise +# for RABBITMQ_SASL_LOGS. This is particularily useful for Docker +# images. + +if [ "$RABBITMQ_LOGS" = '-' ]; then + RABBIT_ERROR_LOGGER='tty' +else + RABBIT_ERROR_LOGGER='{file,"'${RABBITMQ_LOGS}'"}' +fi + +if [ "$RABBITMQ_SASL_LOGS" = '-' ]; then + SASL_ERROR_LOGGER=tty + RABBIT_SASL_ERROR_LOGGER='tty' +else + SASL_ERROR_LOGGER=false + RABBIT_SASL_ERROR_LOGGER='{file,"'${RABBITMQ_SASL_LOGS}'"}' +fi + # we need to turn off path expansion because some of the vars, notably # RABBITMQ_SERVER_ERL_ARGS, contain terms that look like globs and # there is no other way of preventing their expansion. @@ -89,13 +107,16 @@ -boot "${SASL_BOOT_FILE}" \ ${RABBITMQ_CONFIG_ARG} \ +W w \ + +A ${RABBITMQ_IO_THREAD_POOL_SIZE} \ ${RABBITMQ_SERVER_ERL_ARGS} \ + +K true \ + -kernel inet_default_connect_options "[{nodelay,true}]" \ ${RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS} \ ${RABBITMQ_LISTEN_ARG} \ -sasl errlog_type error \ - -sasl sasl_error_logger false \ - -rabbit error_logger '{file,"'${RABBITMQ_LOGS}'"}' \ - -rabbit sasl_error_logger '{file,"'${RABBITMQ_SASL_LOGS}'"}' \ + -sasl sasl_error_logger "$SASL_ERROR_LOGGER" \ + -rabbit error_logger "$RABBIT_ERROR_LOGGER" \ + -rabbit sasl_error_logger "$RABBIT_SASL_ERROR_LOGGER" \ -rabbit enabled_plugins_file "\"$RABBITMQ_ENABLED_PLUGINS_FILE\"" \ -rabbit plugins_dir "\"$RABBITMQ_PLUGINS_DIR\"" \ -rabbit plugins_expand_dir "\"$RABBITMQ_PLUGINS_EXPAND_DIR\"" \ diff --git a/scripts/rabbitmq-server.bat b/scripts/rabbitmq-server.bat index b72b9ee..8f75a48 100755 --- a/scripts/rabbitmq-server.bat +++ b/scripts/rabbitmq-server.bat @@ -12,7 +12,7 @@ REM The Original Code is RabbitMQ. REM REM The Initial Developer of the Original Code is GoPivotal, Inc. -REM Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +REM Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. REM setlocal @@ -23,43 +23,9 @@ set STAR=%* setlocal enabledelayedexpansion -if "!RABBITMQ_USE_LONGNAME!"=="" ( - set RABBITMQ_NAME_TYPE="-sname" -) - -if "!RABBITMQ_USE_LONGNAME!"=="true" ( - set RABBITMQ_NAME_TYPE="-name" -) - -if "!RABBITMQ_BASE!"=="" ( - set RABBITMQ_BASE=!APPDATA!\RabbitMQ -) - -if "!COMPUTERNAME!"=="" ( - set COMPUTERNAME=localhost -) - -if "!RABBITMQ_NODENAME!"=="" ( - set RABBITMQ_NODENAME=rabbit@!COMPUTERNAME! -) - -if "!RABBITMQ_NODE_IP_ADDRESS!"=="" ( - if not "!RABBITMQ_NODE_PORT!"=="" ( - set RABBITMQ_NODE_IP_ADDRESS=auto - ) -) else ( - if "!RABBITMQ_NODE_PORT!"=="" ( - set RABBITMQ_NODE_PORT=5672 - ) -) - -if "!RABBITMQ_DIST_PORT!"=="" ( - if "!RABBITMQ_NODE_PORT!"=="" ( - set RABBITMQ_DIST_PORT=25672 - ) else ( - set /a RABBITMQ_DIST_PORT=20000+!RABBITMQ_NODE_PORT! - ) -) +REM Get default settings with user overrides for (RABBITMQ_) +REM Non-empty defaults should be set in rabbitmq-env +call "%TDP0%\rabbitmq-env.bat" if not exist "!ERLANG_HOME!\bin\erl.exe" ( echo. @@ -71,39 +37,6 @@ echo RabbitMQ server distribution in the Erlang lib folder. echo. exit /B 1 -) - -if "!RABBITMQ_MNESIA_BASE!"=="" ( - set RABBITMQ_MNESIA_BASE=!RABBITMQ_BASE!/db -) -if "!RABBITMQ_LOG_BASE!"=="" ( - set RABBITMQ_LOG_BASE=!RABBITMQ_BASE!/log -) - - -rem We save the previous logs in their respective backup -rem Log management (rotation, filtering based of size...) is left as an exercice for the user. - -set LOGS=!RABBITMQ_LOG_BASE!\!RABBITMQ_NODENAME!.log -set SASL_LOGS=!RABBITMQ_LOG_BASE!\!RABBITMQ_NODENAME!-sasl.log - -rem End of log management - - -if "!RABBITMQ_MNESIA_DIR!"=="" ( - set RABBITMQ_MNESIA_DIR=!RABBITMQ_MNESIA_BASE!/!RABBITMQ_NODENAME!-mnesia -) - -if "!RABBITMQ_PLUGINS_EXPAND_DIR!"=="" ( - set RABBITMQ_PLUGINS_EXPAND_DIR=!RABBITMQ_MNESIA_BASE!/!RABBITMQ_NODENAME!-plugins-expand -) - -if "!RABBITMQ_ENABLED_PLUGINS_FILE!"=="" ( - set RABBITMQ_ENABLED_PLUGINS_FILE=!RABBITMQ_BASE!\enabled_plugins -) - -if "!RABBITMQ_PLUGINS_DIR!"=="" ( - set RABBITMQ_PLUGINS_DIR=!TDP0!..\plugins ) set RABBITMQ_EBIN_ROOT=!TDP0!..\ebin @@ -125,10 +58,6 @@ set RABBITMQ_EBIN_PATH="-pa !RABBITMQ_EBIN_ROOT!" -if "!RABBITMQ_CONFIG_FILE!"=="" ( - set RABBITMQ_CONFIG_FILE=!RABBITMQ_BASE!\rabbitmq -) - if exist "!RABBITMQ_CONFIG_FILE!.config" ( set RABBITMQ_CONFIG_ARG=-config "!RABBITMQ_CONFIG_FILE!" ) else ( @@ -144,7 +73,11 @@ set RABBITMQ_START_RABBIT= if "!RABBITMQ_NODE_ONLY!"=="" ( - set RABBITMQ_START_RABBIT=-s rabbit boot + set RABBITMQ_START_RABBIT=-s "!RABBITMQ_BOOT_MODULE!" boot +) + +if "!RABBITMQ_IO_THREAD_POOL_SIZE!"=="" ( + set RABBITMQ_IO_THREAD_POOL_ARG=30 ) "!ERLANG_HOME!\bin\erl.exe" ^ @@ -155,11 +88,11 @@ !RABBITMQ_CONFIG_ARG! ^ !RABBITMQ_NAME_TYPE! !RABBITMQ_NODENAME! ^ +W w ^ -+A30 ^ ++A "!RABBITMQ_IO_THREAD_POOL_SIZE!" ^ +P 1048576 ^ --kernel inet_default_connect_options "[{nodelay, true}]" ^ !RABBITMQ_LISTEN_ARG! ^ !RABBITMQ_SERVER_ERL_ARGS! ^ +-kernel inet_default_connect_options "[{nodelay, true}]" ^ !RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS! ^ -sasl errlog_type error ^ -sasl sasl_error_logger false ^ diff --git a/scripts/rabbitmq-service.bat b/scripts/rabbitmq-service.bat index 770fd32..d6dd902 100755 --- a/scripts/rabbitmq-service.bat +++ b/scripts/rabbitmq-service.bat @@ -12,7 +12,7 @@ REM The Original Code is RabbitMQ. REM REM The Initial Developer of the Original Code is GoPivotal, Inc. -REM Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +REM Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. REM setlocal @@ -23,6 +23,10 @@ set TDP0=%~dp0 set P1=%1 setlocal enabledelayedexpansion + +REM Get default settings with user overrides for (RABBITMQ_) +REM Non-empty defaults should be set in rabbitmq-env +call "%TDP0%\rabbitmq-env.bat" set STARVAR= shift @@ -32,48 +36,6 @@ shift goto loop1 :after_loop - -if "!RABBITMQ_USE_LONGNAME!"=="" ( - set RABBITMQ_NAME_TYPE="-sname" -) - -if "!RABBITMQ_USE_LONGNAME!"=="true" ( - set RABBITMQ_NAME_TYPE="-name" -) - -if "!RABBITMQ_SERVICENAME!"=="" ( - set RABBITMQ_SERVICENAME=RabbitMQ -) - -if "!RABBITMQ_BASE!"=="" ( - set RABBITMQ_BASE=!APPDATA!\!RABBITMQ_SERVICENAME! -) - -if "!COMPUTERNAME!"=="" ( - set COMPUTERNAME=localhost -) - -if "!RABBITMQ_NODENAME!"=="" ( - set RABBITMQ_NODENAME=rabbit@!COMPUTERNAME! -) - -if "!RABBITMQ_NODE_IP_ADDRESS!"=="" ( - if not "!RABBITMQ_NODE_PORT!"=="" ( - set RABBITMQ_NODE_IP_ADDRESS=auto - ) -) else ( - if "!RABBITMQ_NODE_PORT!"=="" ( - set RABBITMQ_NODE_PORT=5672 - ) -) - -if "!RABBITMQ_DIST_PORT!"=="" ( - if "!RABBITMQ_NODE_PORT!"=="" ( - set RABBITMQ_DIST_PORT=25672 - ) else ( - set /a RABBITMQ_DIST_PORT=20000+!RABBITMQ_NODE_PORT! - ) -) if "!ERLANG_SERVICE_MANAGER_PATH!"=="" ( if not exist "!ERLANG_HOME!\bin\erl.exe" ( @@ -113,31 +75,6 @@ exit /B 1 ) -if "!RABBITMQ_MNESIA_BASE!"=="" ( - set RABBITMQ_MNESIA_BASE=!RABBITMQ_BASE!/db -) -if "!RABBITMQ_LOG_BASE!"=="" ( - set RABBITMQ_LOG_BASE=!RABBITMQ_BASE!/log -) - - -rem We save the previous logs in their respective backup -rem Log management (rotation, filtering based on size...) is left as an exercise for the user. - -set LOGS=!RABBITMQ_LOG_BASE!\!RABBITMQ_NODENAME!.log -set SASL_LOGS=!RABBITMQ_LOG_BASE!\!RABBITMQ_NODENAME!-sasl.log - -rem End of log management - - -if "!RABBITMQ_MNESIA_DIR!"=="" ( - set RABBITMQ_MNESIA_DIR=!RABBITMQ_MNESIA_BASE!/!RABBITMQ_NODENAME!-mnesia -) - -if "!RABBITMQ_PLUGINS_EXPAND_DIR!"=="" ( - set RABBITMQ_PLUGINS_EXPAND_DIR=!RABBITMQ_MNESIA_BASE!/!RABBITMQ_NODENAME!-plugins-expand -) - if "!P1!" == "install" goto INSTALL_SERVICE for %%i in (start stop disable enable list remove) do if "%%i" == "!P1!" goto MODIFY_SERVICE @@ -174,19 +111,7 @@ echo !RABBITMQ_SERVICENAME! service is already present - only updating service parameters ) -if "!RABBITMQ_ENABLED_PLUGINS_FILE!"=="" ( - set RABBITMQ_ENABLED_PLUGINS_FILE=!RABBITMQ_BASE!\enabled_plugins -) - -if "!RABBITMQ_PLUGINS_DIR!"=="" ( - set RABBITMQ_PLUGINS_DIR=!TDP0!..\plugins -) - set RABBITMQ_EBIN_ROOT=!TDP0!..\ebin - -if "!RABBITMQ_CONFIG_FILE!"=="" ( - set RABBITMQ_CONFIG_FILE=!RABBITMQ_BASE!\rabbitmq -) "!ERLANG_HOME!\bin\erl.exe" ^ -pa "!RABBITMQ_EBIN_ROOT!" ^ @@ -224,13 +149,17 @@ set RABBITMQ_START_RABBIT=-s rabbit boot ) +if "!RABBITMQ_IO_THREAD_POOL_SIZE!"=="" ( + set RABBITMQ_IO_THREAD_POOL_SIZE=30 +) + set ERLANG_SERVICE_ARGUMENTS= ^ -pa "!RABBITMQ_EBIN_ROOT!" ^ +-boot start_sasl ^ !RABBITMQ_START_RABBIT! ^ --s rabbit boot ^ !RABBITMQ_CONFIG_ARG! ^ +W w ^ -+A30 ^ ++A "!RABBITMQ_IO_THREAD_POOL_SIZE!" ^ +P 1048576 ^ -kernel inet_default_connect_options "[{nodelay,true}]" ^ !RABBITMQ_LISTEN_ARG! ^ diff --git a/scripts/rabbitmqctl b/scripts/rabbitmqctl index 2237275..03f8765 100755 --- a/scripts/rabbitmqctl +++ b/scripts/rabbitmqctl @@ -12,7 +12,7 @@ ## The Original Code is RabbitMQ. ## ## The Initial Developer of the Original Code is GoPivotal, Inc. -## Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +## Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. ## # Get default settings with user overrides for (RABBITMQ_) diff --git a/scripts/rabbitmqctl.bat b/scripts/rabbitmqctl.bat index 380b57a..45e2929 100755 --- a/scripts/rabbitmqctl.bat +++ b/scripts/rabbitmqctl.bat @@ -12,9 +12,10 @@ REM The Original Code is RabbitMQ. REM REM The Initial Developer of the Original Code is GoPivotal, Inc. -REM Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +REM Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. REM +REM Scopes the variables to the current batch file setlocal rem Preserve values that might contain exclamation marks before @@ -22,26 +23,6 @@ set TDP0=%~dp0 set STAR=%* setlocal enabledelayedexpansion - -if "!RABBITMQ_BASE!"=="" ( - set RABBITMQ_BASE=!APPDATA!\RabbitMQ -) - -if "!COMPUTERNAME!"=="" ( - set COMPUTERNAME=localhost -) - -if "!RABBITMQ_NODENAME!"=="" ( - set RABBITMQ_NODENAME=rabbit@!COMPUTERNAME! -) - -if "!RABBITMQ_MNESIA_BASE!"=="" ( - set RABBITMQ_MNESIA_BASE=!RABBITMQ_BASE!/db -) - -if "!RABBITMQ_MNESIA_DIR!"=="" ( - set RABBITMQ_MNESIA_DIR=!RABBITMQ_MNESIA_BASE!/!RABBITMQ_NODENAME!-mnesia -) if not exist "!ERLANG_HOME!\bin\erl.exe" ( echo. @@ -54,6 +35,10 @@ echo. exit /B 1 ) + +REM Get default settings with user overrides for (RABBITMQ_) +REM Non-empty defaults should be set in rabbitmq-env +call "%TDP0%\rabbitmq-env.bat" "!ERLANG_HOME!\bin\erl.exe" ^ -pa "!TDP0!..\ebin" ^ diff --git a/src/app_utils.erl b/src/app_utils.erl index 87e6fa0..bab327e 100644 --- a/src/app_utils.erl +++ b/src/app_utils.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(app_utils). diff --git a/src/background_gc.erl b/src/background_gc.erl index d30fa89..0dafde6 100644 --- a/src/background_gc.erl +++ b/src/background_gc.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(background_gc). diff --git a/src/credit_flow.erl b/src/credit_flow.erl index 8932062..6b24175 100644 --- a/src/credit_flow.erl +++ b/src/credit_flow.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(credit_flow). @@ -68,6 +68,11 @@ put(Key, Expr) end). +%% If current process was blocked by credit flow in the last +%% STATE_CHANGE_INTERVAL milliseconds, state/0 will report it as "in +%% flow". +-define(STATE_CHANGE_INTERVAL, 1000000). + %%---------------------------------------------------------------------------- %% There are two "flows" here; of messages and of credit, going in @@ -117,7 +122,7 @@ false -> case get(credit_blocked_at) of undefined -> running; B -> Diff = timer:now_diff(erlang:now(), B), - case Diff < 5000000 of + case Diff < ?STATE_CHANGE_INTERVAL of true -> flow; false -> running end diff --git a/src/delegate.erl b/src/delegate.erl index 1a0df98..4bf570c 100644 --- a/src/delegate.erl +++ b/src/delegate.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(delegate). diff --git a/src/delegate_sup.erl b/src/delegate_sup.erl index cb5ef2b..a285667 100644 --- a/src/delegate_sup.erl +++ b/src/delegate_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(delegate_sup). diff --git a/src/dtree.erl b/src/dtree.erl index 9013bd6..0fef3b2 100644 --- a/src/dtree.erl +++ b/src/dtree.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% A dual-index tree. diff --git a/src/file_handle_cache.erl b/src/file_handle_cache.erl index d0fd524..8be19e5 100644 --- a/src/file_handle_cache.erl +++ b/src/file_handle_cache.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(file_handle_cache). @@ -148,7 +148,7 @@ copy/3, set_maximum_since_use/1, delete/1, clear/1]). -export([obtain/0, obtain/1, release/0, release/1, transfer/1, transfer/2, set_limit/1, get_limit/0, info_keys/0, with_handle/1, with_handle/2, - info/0, info/1]). + info/0, info/1, clear_read_cache/0]). -export([ulimit/0]). -export([start_link/0, start_link/2, init/1, handle_call/3, handle_cast/2, @@ -163,6 +163,8 @@ -define(OBTAIN_LIMIT(LIMIT), trunc((LIMIT * 0.9) - 2)). -define(CLIENT_ETS_TABLE, file_handle_cache_client). -define(ELDERS_ETS_TABLE, file_handle_cache_elders). + +-include("rabbit.hrl"). % For #amqqueue record definition. %%---------------------------------------------------------------------------- @@ -353,6 +355,7 @@ read_buffer_rem = BufRem - Count, read_buffer_usage = BufUsg + Count }]}; ([Handle0]) -> + maybe_reduce_read_cache([Ref]), Handle = #handle{read_buffer = Buf, read_buffer_pos = BufPos, read_buffer_rem = BufRem, @@ -580,6 +583,42 @@ info() -> info(?INFO_KEYS). info(Items) -> gen_server2:call(?SERVER, {info, Items}, infinity). +clear_read_cache() -> + gen_server2:cast(?SERVER, clear_read_cache), + clear_vhost_read_cache(rabbit_vhost:list()). + +clear_vhost_read_cache([]) -> + ok; +clear_vhost_read_cache([VHost | Rest]) -> + clear_queue_read_cache(rabbit_amqqueue:list(VHost)), + clear_vhost_read_cache(Rest). + +clear_queue_read_cache([]) -> + ok; +clear_queue_read_cache([#amqqueue{pid = MPid, slave_pids = SPids} | Rest]) -> + %% Limit the action to the current node. + Pids = [P || P <- [MPid | SPids], node(P) =:= node()], + %% This function is executed in the context of the backing queue + %% process because the read buffer is stored in the process + %% dictionary. + Fun = fun(_, State) -> + clear_process_read_cache(), + State + end, + [rabbit_amqqueue:run_backing_queue(Pid, rabbit_variable_queue, Fun) + || Pid <- Pids], + clear_queue_read_cache(Rest). + +clear_process_read_cache() -> + [ + begin + Handle1 = reset_read_buffer(Handle), + put({Ref, fhc_handle}, Handle1) + end || + {{Ref, fhc_handle}, Handle} <- get(), + size(Handle#handle.read_buffer) > 0 + ]. + %%---------------------------------------------------------------------------- %% Internal functions %%---------------------------------------------------------------------------- @@ -962,6 +1001,37 @@ false -> Usg * 2 end, Lim)}. +maybe_reduce_read_cache(SparedRefs) -> + case rabbit_memory_monitor:memory_use(bytes) of + {_, infinity} -> ok; + {MemUse, MemLimit} when MemUse < MemLimit -> ok; + {MemUse, MemLimit} -> reduce_read_cache( + (MemUse - MemLimit) * 2, + SparedRefs) + end. + +reduce_read_cache(MemToFree, SparedRefs) -> + Handles = lists:sort( + fun({_, H1}, {_, H2}) -> H1 < H2 end, + [{R, H} || {{R, fhc_handle}, H} <- get(), + not lists:member(R, SparedRefs) + andalso size(H#handle.read_buffer) > 0]), + FreedMem = lists:foldl( + fun + (_, Freed) when Freed >= MemToFree -> + Freed; + ({Ref, #handle{read_buffer = Buf} = Handle}, Freed) -> + Handle1 = reset_read_buffer(Handle), + put({Ref, fhc_handle}, Handle1), + Freed + size(Buf) + end, 0, Handles), + if + FreedMem < MemToFree andalso SparedRefs =/= [] -> + reduce_read_cache(MemToFree - FreedMem, []); + true -> + ok + end. + infos(Items, State) -> [{Item, i(Item, State)} || Item <- Items]. i(total_limit, #fhc_state{limit = Limit}) -> Limit; @@ -1115,7 +1185,11 @@ {noreply, process_pending( update_counts({obtain, socket}, ToPid, +N, update_counts({obtain, socket}, FromPid, -N, - State)))}. + State)))}; + +handle_cast(clear_read_cache, State) -> + clear_process_read_cache(), + {noreply, State}. handle_info(check_counts, State) -> {noreply, maybe_reduce(State #fhc_state { timer_ref = undefined })}; diff --git a/src/file_handle_cache_stats.erl b/src/file_handle_cache_stats.erl index de2f90c..5f6926b 100644 --- a/src/file_handle_cache_stats.erl +++ b/src/file_handle_cache_stats.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(file_handle_cache_stats). diff --git a/src/gatherer.erl b/src/gatherer.erl index 6a71021..89bd46c 100644 --- a/src/gatherer.erl +++ b/src/gatherer.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(gatherer). diff --git a/src/gen_server2.erl b/src/gen_server2.erl index d2f96b5..fd0e655 100644 --- a/src/gen_server2.erl +++ b/src/gen_server2.erl @@ -576,10 +576,11 @@ {ok, State, Timeout, Backoff = {backoff, _, _, _}, Mod1} -> Backoff1 = extend_backoff(Backoff), proc_lib:init_ack(Starter, {ok, self()}), - loop(GS2State #gs2_state { mod = Mod1, - state = State, - time = Timeout, - timeout_state = Backoff1 }); + loop(find_prioritisers( + GS2State #gs2_state { mod = Mod1, + state = State, + time = Timeout, + timeout_state = Backoff1 })); {stop, Reason} -> %% For consistency, we must make sure that the %% registered name (if any) is unregistered before diff --git a/src/gm.erl b/src/gm.erl index 636e63e..95dc84e 100644 --- a/src/gm.erl +++ b/src/gm.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(gm). diff --git a/src/lqueue.erl b/src/lqueue.erl index 941941d..4e78346 100644 --- a/src/lqueue.erl +++ b/src/lqueue.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2011-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2011-2015 Pivotal Software, Inc. All rights reserved. %% -module(lqueue). diff --git a/src/mirrored_supervisor.erl b/src/mirrored_supervisor.erl index 289b9cc..96c1418 100644 --- a/src/mirrored_supervisor.erl +++ b/src/mirrored_supervisor.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2011-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2011-2015 Pivotal Software, Inc. All rights reserved. %% -module(mirrored_supervisor). diff --git a/src/mirrored_supervisor_sups.erl b/src/mirrored_supervisor_sups.erl index 6ec0843..404b86f 100644 --- a/src/mirrored_supervisor_sups.erl +++ b/src/mirrored_supervisor_sups.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2011-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2011-2015 Pivotal Software, Inc. All rights reserved. %% -module(mirrored_supervisor_sups). diff --git a/src/mnesia_sync.erl b/src/mnesia_sync.erl index 8fa54d6..153017b 100644 --- a/src/mnesia_sync.erl +++ b/src/mnesia_sync.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(mnesia_sync). diff --git a/src/pmon.erl b/src/pmon.erl index 7981742..f425300 100644 --- a/src/pmon.erl +++ b/src/pmon.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2011-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2011-2015 Pivotal Software, Inc. All rights reserved. %% -module(pmon). diff --git a/src/priority_queue.erl b/src/priority_queue.erl index a3573bb..88c6951 100644 --- a/src/priority_queue.erl +++ b/src/priority_queue.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% Priority queues have essentially the same interface as ordinary diff --git a/src/rabbit.erl b/src/rabbit.erl index b55c129..84aaf4e 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit). @@ -40,6 +40,13 @@ {requires, pre_boot}, {enables, external_infrastructure}]}). +%% rabbit_alarm currently starts memory and disk space monitors +-rabbit_boot_step({rabbit_alarm, + [{description, "alarm handler"}, + {mfa, {rabbit_alarm, start, []}}, + {requires, pre_boot}, + {enables, external_infrastructure}]}). + -rabbit_boot_step({database, [{mfa, {rabbit_mnesia, init, []}}, {requires, file_handle_cache}, @@ -54,7 +61,8 @@ -rabbit_boot_step({file_handle_cache, [{description, "file handle cache server"}, {mfa, {rabbit, start_fhc, []}}, - {requires, pre_boot}, + %% FHC needs memory monitor to be running + {requires, rabbit_alarm}, {enables, worker_pool}]}). -rabbit_boot_step({worker_pool, @@ -84,12 +92,6 @@ -rabbit_boot_step({kernel_ready, [{description, "kernel ready"}, {requires, external_infrastructure}]}). - --rabbit_boot_step({rabbit_alarm, - [{description, "alarm handler"}, - {mfa, {rabbit_alarm, start, []}}, - {requires, kernel_ready}, - {enables, core_initialized}]}). -rabbit_boot_step({rabbit_memory_monitor, [{description, "memory monitor"}, @@ -883,6 +885,33 @@ %% We don't want this in fhc since it references rabbit stuff. And we can't put %% this in the bootstep directly. start_fhc() -> - rabbit_sup:start_restartable_child( + ok = rabbit_sup:start_restartable_child( file_handle_cache, - [fun rabbit_alarm:set_alarm/1, fun rabbit_alarm:clear_alarm/1]). + [fun rabbit_alarm:set_alarm/1, fun rabbit_alarm:clear_alarm/1]), + ensure_working_fhc(). + +ensure_working_fhc() -> + %% To test the file handle cache, we simply read a file we know it + %% exists (Erlang kernel's .app file). + %% + %% To avoid any pollution of the application process' dictionary by + %% file_handle_cache, we spawn a separate process. + Parent = self(), + TestFun = fun() -> + Filename = filename:join(code:lib_dir(kernel, ebin), "kernel.app"), + {ok, Fd} = file_handle_cache:open(Filename, [raw, binary, read], []), + {ok, _} = file_handle_cache:read(Fd, 1), + ok = file_handle_cache:close(Fd), + Parent ! fhc_ok + end, + TestPid = spawn_link(TestFun), + %% Because we are waiting for the test fun, abuse the + %% 'mnesia_table_loading_timeout' parameter to find a sane timeout + %% value. + Timeout = rabbit_table:wait_timeout(), + receive + fhc_ok -> ok; + {'EXIT', TestPid, Exception} -> throw({ensure_working_fhc, Exception}) + after Timeout -> + throw({ensure_working_fhc, {timeout, TestPid}}) + end. diff --git a/src/rabbit_access_control.erl b/src/rabbit_access_control.erl index 41c54b0..fc7a59c 100644 --- a/src/rabbit_access_control.erl +++ b/src/rabbit_access_control.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_access_control). diff --git a/src/rabbit_alarm.erl b/src/rabbit_alarm.erl index 308f9a2..557fa31 100644 --- a/src/rabbit_alarm.erl +++ b/src/rabbit_alarm.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_alarm). diff --git a/src/rabbit_amqqueue.erl b/src/rabbit_amqqueue.erl index 2ab03cc..5bfa006 100644 --- a/src/rabbit_amqqueue.erl +++ b/src/rabbit_amqqueue.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_amqqueue). @@ -782,14 +782,40 @@ fun () -> Qs = mnesia:match_object(rabbit_queue, #amqqueue{_ = '_'}, write), - [case lists:member(Node, RSs) of - true -> RSs1 = RSs -- [Node], - store_queue( - Q#amqqueue{recoverable_slaves = RSs1}); - false -> ok - end || #amqqueue{recoverable_slaves = RSs} = Q <- Qs], + [maybe_clear_recoverable_node(Node, Q) || Q <- Qs], ok end). + +maybe_clear_recoverable_node(Node, + #amqqueue{sync_slave_pids = SPids, + recoverable_slaves = RSs} = Q) -> + case lists:member(Node, RSs) of + true -> + %% There is a race with + %% rabbit_mirror_queue_slave:record_synchronised/1 called + %% by the incoming slave node and this function, called + %% by the master node. If this function is executed after + %% record_synchronised/1, the node is erroneously removed + %% from the recoverable slaves list. + %% + %% We check if the slave node's queue PID is alive. If it is + %% the case, then this function is executed after. In this + %% situation, we don't touch the queue record, it is already + %% correct. + DoClearNode = + case [SP || SP <- SPids, node(SP) =:= Node] of + [SPid] -> not rabbit_misc:is_process_alive(SPid); + _ -> true + end, + if + DoClearNode -> RSs1 = RSs -- [Node], + store_queue( + Q#amqqueue{recoverable_slaves = RSs1}); + true -> ok + end; + false -> + ok + end. on_node_down(Node) -> rabbit_misc:execute_mnesia_tx_with_tail( diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl index c6030a0..c5e4206 100644 --- a/src/rabbit_amqqueue_process.erl +++ b/src/rabbit_amqqueue_process.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_amqqueue_process). diff --git a/src/rabbit_amqqueue_sup.erl b/src/rabbit_amqqueue_sup.erl index 465c041..f05ff43 100644 --- a/src/rabbit_amqqueue_sup.erl +++ b/src/rabbit_amqqueue_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_amqqueue_sup). diff --git a/src/rabbit_amqqueue_sup_sup.erl b/src/rabbit_amqqueue_sup_sup.erl index 793cb7c..4c4bb52 100644 --- a/src/rabbit_amqqueue_sup_sup.erl +++ b/src/rabbit_amqqueue_sup_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_amqqueue_sup_sup). diff --git a/src/rabbit_auth_backend_dummy.erl b/src/rabbit_auth_backend_dummy.erl index d2f07c1..ee6dabe 100644 --- a/src/rabbit_auth_backend_dummy.erl +++ b/src/rabbit_auth_backend_dummy.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_auth_backend_dummy). diff --git a/src/rabbit_auth_backend_internal.erl b/src/rabbit_auth_backend_internal.erl index 20a5766..e53ce50 100644 --- a/src/rabbit_auth_backend_internal.erl +++ b/src/rabbit_auth_backend_internal.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_auth_backend_internal). diff --git a/src/rabbit_auth_mechanism.erl b/src/rabbit_auth_mechanism.erl index c8e23a7..78e3e7d 100644 --- a/src/rabbit_auth_mechanism.erl +++ b/src/rabbit_auth_mechanism.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_auth_mechanism). diff --git a/src/rabbit_auth_mechanism_amqplain.erl b/src/rabbit_auth_mechanism_amqplain.erl index e2183a9..621c575 100644 --- a/src/rabbit_auth_mechanism_amqplain.erl +++ b/src/rabbit_auth_mechanism_amqplain.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_auth_mechanism_amqplain). diff --git a/src/rabbit_auth_mechanism_cr_demo.erl b/src/rabbit_auth_mechanism_cr_demo.erl index b5751f4..d9d7b11 100644 --- a/src/rabbit_auth_mechanism_cr_demo.erl +++ b/src/rabbit_auth_mechanism_cr_demo.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_auth_mechanism_cr_demo). diff --git a/src/rabbit_auth_mechanism_plain.erl b/src/rabbit_auth_mechanism_plain.erl index c008f6a..7a5f433 100644 --- a/src/rabbit_auth_mechanism_plain.erl +++ b/src/rabbit_auth_mechanism_plain.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_auth_mechanism_plain). diff --git a/src/rabbit_authn_backend.erl b/src/rabbit_authn_backend.erl index cfc3f5d..b9cb0d3 100644 --- a/src/rabbit_authn_backend.erl +++ b/src/rabbit_authn_backend.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_authn_backend). diff --git a/src/rabbit_authz_backend.erl b/src/rabbit_authz_backend.erl index ff5f014..12364b6 100644 --- a/src/rabbit_authz_backend.erl +++ b/src/rabbit_authz_backend.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_authz_backend). diff --git a/src/rabbit_autoheal.erl b/src/rabbit_autoheal.erl index 566c8bb..cd53127 100644 --- a/src/rabbit_autoheal.erl +++ b/src/rabbit_autoheal.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_autoheal). diff --git a/src/rabbit_backing_queue.erl b/src/rabbit_backing_queue.erl index 55c8c97..d6cd3ca 100644 --- a/src/rabbit_backing_queue.erl +++ b/src/rabbit_backing_queue.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_backing_queue). @@ -252,10 +252,11 @@ behaviour_info(callbacks) -> [{start, 1}, {stop, 0}, {init, 3}, {terminate, 2}, - {delete_and_terminate, 2}, {purge, 1}, {purge_acks, 1}, {publish, 6}, + {delete_and_terminate, 2}, {delete_crashed, 1}, {purge, 1}, + {purge_acks, 1}, {publish, 6}, {publish_delivered, 5}, {discard, 4}, {drain_confirmed, 1}, - {dropwhile, 2}, {fetchwhile, 4}, - {fetch, 2}, {ack, 2}, {requeue, 2}, {ackfold, 4}, {fold, 3}, {len, 1}, + {dropwhile, 2}, {fetchwhile, 4}, {fetch, 2}, + {drop, 2}, {ack, 2}, {requeue, 2}, {ackfold, 4}, {fold, 3}, {len, 1}, {is_empty, 1}, {depth, 1}, {set_ram_duration_target, 2}, {ram_duration, 1}, {needs_timeout, 1}, {timeout, 1}, {handle_pre_hibernate, 1}, {resume, 1}, {msg_rates, 1}, diff --git a/src/rabbit_basic.erl b/src/rabbit_basic.erl index 1cb6bef..efc5ce2 100644 --- a/src/rabbit_basic.erl +++ b/src/rabbit_basic.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_basic). diff --git a/src/rabbit_binary_generator.erl b/src/rabbit_binary_generator.erl index 53ba35d..34f2d60 100644 --- a/src/rabbit_binary_generator.erl +++ b/src/rabbit_binary_generator.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_binary_generator). diff --git a/src/rabbit_binary_parser.erl b/src/rabbit_binary_parser.erl index ee8147f..8b3bf3e 100644 --- a/src/rabbit_binary_parser.erl +++ b/src/rabbit_binary_parser.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_binary_parser). diff --git a/src/rabbit_binding.erl b/src/rabbit_binding.erl index 53af2f2..77a9277 100644 --- a/src/rabbit_binding.erl +++ b/src/rabbit_binding.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_binding). diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index 4e2a9e1..489f7b3 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_channel). @@ -40,7 +40,9 @@ queue_consumers, delivering_queues, queue_collector_pid, stats_timer, confirm_enabled, publish_seqno, unconfirmed, confirmed, mandatory, capabilities, trace_state, - consumer_prefetch, reply_consumer}). + consumer_prefetch, reply_consumer, + %% flow | noflow, see rabbitmq-server#114 + delivery_flow}). -define(MAX_PERMISSION_CACHE_SIZE, 12). @@ -235,6 +237,10 @@ process_flag(trap_exit, true), ?store_proc_name({ConnName, Channel}), ok = pg_local:join(rabbit_channels, self()), + Flow = case rabbit_misc:get_env(rabbit, mirroring_flow_control, true) of + true -> flow; + false -> noflow + end, State = #ch{state = starting, protocol = Protocol, channel = Channel, @@ -263,7 +269,8 @@ capabilities = Capabilities, trace_state = rabbit_trace:init(VHost), consumer_prefetch = 0, - reply_consumer = none}, + reply_consumer = none, + delivery_flow = Flow}, State1 = rabbit_event:init_stats_timer(State, #ch.stats_timer), rabbit_event:notify(channel_created, infos(?CREATION_EVENT_KEYS, State1)), rabbit_event:if_enabled(State1, #ch.stats_timer, @@ -770,7 +777,8 @@ confirm_enabled = ConfirmEnabled, trace_state = TraceState, user = #user{username = Username}, - conn_name = ConnName}) -> + conn_name = ConnName, + delivery_flow = Flow}) -> check_msg_size(Content), ExchangeName = rabbit_misc:r(VHostPath, exchange, ExchangeNameBin), check_write_permitted(ExchangeName, State), @@ -797,7 +805,7 @@ QNames = rabbit_exchange:route(Exchange, Delivery), rabbit_trace:tap_in(Message, QNames, ConnName, ChannelNum, Username, TraceState), - DQ = {Delivery#delivery{flow = flow}, QNames}, + DQ = {Delivery#delivery{flow = Flow}, QNames}, {noreply, case Tx of none -> deliver_to_queues(DQ, State1); {Msgs, Acks} -> Msgs1 = queue:in(DQ, Msgs), diff --git a/src/rabbit_channel_interceptor.erl b/src/rabbit_channel_interceptor.erl index db9349a..25c5df8 100644 --- a/src/rabbit_channel_interceptor.erl +++ b/src/rabbit_channel_interceptor.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% Since the AMQP methods used here are queue related, diff --git a/src/rabbit_channel_sup.erl b/src/rabbit_channel_sup.erl index 448d17a..e8f45f7 100644 --- a/src/rabbit_channel_sup.erl +++ b/src/rabbit_channel_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_channel_sup). diff --git a/src/rabbit_channel_sup_sup.erl b/src/rabbit_channel_sup_sup.erl index d0e8254..2be2af9 100644 --- a/src/rabbit_channel_sup_sup.erl +++ b/src/rabbit_channel_sup_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_channel_sup_sup). diff --git a/src/rabbit_cli.erl b/src/rabbit_cli.erl index cf7b608..33098ce 100644 --- a/src/rabbit_cli.erl +++ b/src/rabbit_cli.erl @@ -11,14 +11,14 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_cli). -include("rabbit_cli.hrl"). -export([main/3, start_distribution/0, start_distribution/1, - parse_arguments/4, rpc_call/4]). + parse_arguments/4, rpc_call/4, rpc_call/5]). %%---------------------------------------------------------------------------- @@ -94,8 +94,13 @@ print_error("~p", [Reason]), rabbit_misc:quit(2); {badrpc, Reason} -> - print_error("unable to connect to node ~w: ~w", [Node, Reason]), - print_badrpc_diagnostics([Node]), + case Reason of + timeout -> + print_error("operation ~w on node ~w timed out", [Command, Node]); + _ -> + print_error("unable to connect to node ~w: ~w", [Node, Reason]), + print_badrpc_diagnostics([Node]) + end, rabbit_misc:quit(2); {badrpc_multi, Reason, Nodes} -> print_error("unable to connect to nodes ~p: ~w", [Nodes, Reason]), @@ -210,8 +215,11 @@ %% a timeout unless we set our ticktime to be the same. So let's do %% that. rpc_call(Node, Mod, Fun, Args) -> - case rpc:call(Node, net_kernel, get_net_ticktime, [], ?RPC_TIMEOUT) of + rpc_call(Node, Mod, Fun, Args, ?RPC_TIMEOUT). + +rpc_call(Node, Mod, Fun, Args, Timeout) -> + case rpc:call(Node, net_kernel, get_net_ticktime, [], Timeout) of {badrpc, _} = E -> E; Time -> net_kernel:set_net_ticktime(Time, 0), - rpc:call(Node, Mod, Fun, Args, ?RPC_TIMEOUT) - end. + rpc:call(Node, Mod, Fun, Args, Timeout) + end. diff --git a/src/rabbit_client_sup.erl b/src/rabbit_client_sup.erl index dcf8c9e..5348d01 100644 --- a/src/rabbit_client_sup.erl +++ b/src/rabbit_client_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_client_sup). diff --git a/src/rabbit_command_assembler.erl b/src/rabbit_command_assembler.erl index 20397cc..f93b85b 100644 --- a/src/rabbit_command_assembler.erl +++ b/src/rabbit_command_assembler.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_command_assembler). diff --git a/src/rabbit_connection_helper_sup.erl b/src/rabbit_connection_helper_sup.erl index 85266bd..d3c05ee 100644 --- a/src/rabbit_connection_helper_sup.erl +++ b/src/rabbit_connection_helper_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_connection_helper_sup). diff --git a/src/rabbit_connection_sup.erl b/src/rabbit_connection_sup.erl index 1dfdada..9826085 100644 --- a/src/rabbit_connection_sup.erl +++ b/src/rabbit_connection_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_connection_sup). diff --git a/src/rabbit_control_main.erl b/src/rabbit_control_main.erl index 810f5f6..fe0563b 100644 --- a/src/rabbit_control_main.erl +++ b/src/rabbit_control_main.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_control_main). @@ -19,13 +19,14 @@ -include("rabbit_cli.hrl"). -export([start/0, stop/0, parse_arguments/2, action/5, - sync_queue/1, cancel_sync_queue/1, become/1]). - --import(rabbit_cli, [rpc_call/4]). + sync_queue/1, cancel_sync_queue/1, become/1, + purge_queue/1]). + +-import(rabbit_cli, [rpc_call/4, rpc_call/5]). -define(EXTERNAL_CHECK_INTERVAL, 1000). --define(GLOBAL_DEFS(Node), [?QUIET_DEF, ?NODE_DEF(Node)]). +-define(GLOBAL_DEFS(Node), [?QUIET_DEF, ?NODE_DEF(Node), ?TIMEOUT_DEF]). -define(COMMANDS, [stop, @@ -45,6 +46,7 @@ cluster_status, {sync_queue, [?VHOST_DEF]}, {cancel_sync_queue, [?VHOST_DEF]}, + {purge_queue, [?VHOST_DEF]}, add_user, delete_user, @@ -108,6 +110,12 @@ forget_cluster_node, rename_cluster_node, cluster_status, status, environment, eval, force_boot]). +-define(COMMANDS_WITH_TIMEOUT, + [list_user_permissions, list_policies, list_queues, list_exchanges, + list_bindings, list_connections, list_channels, list_consumers, + list_vhosts, list_parameters, + purge_queue]). + %%---------------------------------------------------------------------------- -ifdef(use_specs). @@ -117,6 +125,11 @@ -spec(action/5 :: (atom(), node(), [string()], [{string(), any()}], fun ((string(), [any()]) -> 'ok')) + -> 'ok'). + +-spec(action/6 :: + (atom(), node(), [string()], [{string(), any()}], + fun ((string(), [any()]) -> 'ok'), timeout()) -> 'ok'). -endif. @@ -136,7 +149,19 @@ io:format(Format ++ " ...~n", Args1) end end, - do_action(Command, Node, Args, Opts, Inform) + try + T = case get_timeout(Opts) of + {ok, Timeout} -> + Timeout; + {error, _} -> + %% since this is an error with user input, ignore the quiet + %% setting + io:format("Failed to parse provided timeout value, using ~s~n", [?RPC_TIMEOUT]), + ?RPC_TIMEOUT + end, + do_action(Command, Node, Args, Opts, Inform, T) + catch _:E -> E + end end, rabbit_ctl_usage). parse_arguments(CmdLine, NodeStr) -> @@ -160,18 +185,64 @@ end, io:nl(). +get_timeout(Opts) -> + parse_timeout(proplists:get_value(?TIMEOUT_OPT, Opts, ?RPC_TIMEOUT)). + +parse_number(N) when is_list(N) -> + try list_to_integer(N) of + Val -> Val + catch error:badarg -> + %% could have been a float, give it + %% another shot + list_to_float(N) + end. + +parse_timeout("infinity") -> + {ok, infinity}; +parse_timeout(infinity) -> + {ok, infinity}; +parse_timeout(N) when is_list(N) -> + try parse_number(N) of + M -> + Y = case M >= 0 of + true -> round(M) * 1000; + false -> ?RPC_TIMEOUT + end, + {ok, Y} + catch error:badarg -> + {error, infinity} + end; +parse_timeout(N) -> + {ok, N}. + +announce_timeout(infinity, _Inform) -> + %% no-op + ok; +announce_timeout(Timeout, Inform) when is_number(Timeout) -> + Inform("Timeout: ~w seconds", [Timeout/1000]), + ok. + stop() -> ok. %%---------------------------------------------------------------------------- -do_action(Command, Node, Args, Opts, Inform) -> +do_action(Command, Node, Args, Opts, Inform, Timeout) -> case lists:member(Command, ?COMMANDS_NOT_REQUIRING_APP) of - false -> case ensure_app_running(Node) of - ok -> action(Command, Node, Args, Opts, Inform); - E -> E - end; - true -> action(Command, Node, Args, Opts, Inform) + false -> + case ensure_app_running(Node) of + ok -> + case lists:member(Command, ?COMMANDS_WITH_TIMEOUT) of + true -> + announce_timeout(Timeout, Inform), + action(Command, Node, Args, Opts, Inform, Timeout); + false -> + action(Command, Node, Args, Opts, Inform) + end; + E -> E + end; + true -> + action(Command, Node, Args, Opts, Inform) end. action(stop, Node, Args, _Opts, Inform) -> @@ -313,12 +384,6 @@ rpc_call(Node, rabbit_auth_backend_internal, set_tags, [list_to_binary(Username), Tags]); -action(list_users, Node, [], _Opts, Inform) -> - Inform("Listing users", []), - display_info_list( - call(Node, {rabbit_auth_backend_internal, list_users, []}), - rabbit_auth_backend_internal:user_info_keys()); - action(add_vhost, Node, Args = [_VHostPath], _Opts, Inform) -> Inform("Creating vhost \"~s\"", Args), call(Node, {rabbit_vhost, add, Args}); @@ -326,63 +391,6 @@ action(delete_vhost, Node, Args = [_VHostPath], _Opts, Inform) -> Inform("Deleting vhost \"~s\"", Args), call(Node, {rabbit_vhost, delete, Args}); - -action(list_vhosts, Node, Args, _Opts, Inform) -> - Inform("Listing vhosts", []), - ArgAtoms = default_if_empty(Args, [name]), - display_info_list(call(Node, {rabbit_vhost, info_all, []}), ArgAtoms); - -action(list_user_permissions, Node, Args = [_Username], _Opts, Inform) -> - Inform("Listing permissions for user ~p", Args), - display_info_list(call(Node, {rabbit_auth_backend_internal, - list_user_permissions, Args}), - rabbit_auth_backend_internal:user_perms_info_keys()); - -action(list_queues, Node, Args, Opts, Inform) -> - Inform("Listing queues", []), - VHostArg = list_to_binary(proplists:get_value(?VHOST_OPT, Opts)), - ArgAtoms = default_if_empty(Args, [name, messages]), - display_info_list(rpc_call(Node, rabbit_amqqueue, info_all, - [VHostArg, ArgAtoms]), - ArgAtoms); - -action(list_exchanges, Node, Args, Opts, Inform) -> - Inform("Listing exchanges", []), - VHostArg = list_to_binary(proplists:get_value(?VHOST_OPT, Opts)), - ArgAtoms = default_if_empty(Args, [name, type]), - display_info_list(rpc_call(Node, rabbit_exchange, info_all, - [VHostArg, ArgAtoms]), - ArgAtoms); - -action(list_bindings, Node, Args, Opts, Inform) -> - Inform("Listing bindings", []), - VHostArg = list_to_binary(proplists:get_value(?VHOST_OPT, Opts)), - ArgAtoms = default_if_empty(Args, [source_name, source_kind, - destination_name, destination_kind, - routing_key, arguments]), - display_info_list(rpc_call(Node, rabbit_binding, info_all, - [VHostArg, ArgAtoms]), - ArgAtoms); - -action(list_connections, Node, Args, _Opts, Inform) -> - Inform("Listing connections", []), - ArgAtoms = default_if_empty(Args, [user, peer_host, peer_port, state]), - display_info_list(rpc_call(Node, rabbit_networking, connection_info_all, - [ArgAtoms]), - ArgAtoms); - -action(list_channels, Node, Args, _Opts, Inform) -> - Inform("Listing channels", []), - ArgAtoms = default_if_empty(Args, [pid, user, consumer_count, - messages_unacknowledged]), - display_info_list(rpc_call(Node, rabbit_channel, info_all, [ArgAtoms]), - ArgAtoms); - -action(list_consumers, Node, _Args, Opts, Inform) -> - Inform("Listing consumers", []), - VHostArg = list_to_binary(proplists:get_value(?VHOST_OPT, Opts)), - display_info_list(rpc_call(Node, rabbit_amqqueue, consumers_all, [VHostArg]), - rabbit_amqqueue:consumer_info_keys()); action(trace_on, Node, [], Opts, Inform) -> VHost = proplists:get_value(?VHOST_OPT, Opts), @@ -416,13 +424,6 @@ call(Node, {rabbit_auth_backend_internal, clear_permissions, [Username, VHost]}); -action(list_permissions, Node, [], Opts, Inform) -> - VHost = proplists:get_value(?VHOST_OPT, Opts), - Inform("Listing permissions in vhost \"~s\"", [VHost]), - display_info_list(call(Node, {rabbit_auth_backend_internal, - list_vhost_permissions, [VHost]}), - rabbit_auth_backend_internal:vhost_perms_info_keys()); - action(set_parameter, Node, [Component, Key, Value], Opts, Inform) -> VHostArg = list_to_binary(proplists:get_value(?VHOST_OPT, Opts)), Inform("Setting runtime parameter ~p for component ~p to ~p", @@ -437,13 +438,6 @@ rpc_call(Node, rabbit_runtime_parameters, clear, [VHostArg, list_to_binary(Component), list_to_binary(Key)]); - -action(list_parameters, Node, [], Opts, Inform) -> - VHostArg = list_to_binary(proplists:get_value(?VHOST_OPT, Opts)), - Inform("Listing runtime parameters", []), - display_info_list( - rpc_call(Node, rabbit_runtime_parameters, list_formatted, [VHostArg]), - rabbit_runtime_parameters:info_keys()); action(set_policy, Node, [Key, Pattern, Defn], Opts, Inform) -> Msg = "Setting policy ~p for pattern ~p to ~p with priority ~p", @@ -459,12 +453,6 @@ VHostArg = list_to_binary(proplists:get_value(?VHOST_OPT, Opts)), Inform("Clearing policy ~p", [Key]), rpc_call(Node, rabbit_policy, delete, [VHostArg, list_to_binary(Key)]); - -action(list_policies, Node, [], Opts, Inform) -> - VHostArg = list_to_binary(proplists:get_value(?VHOST_OPT, Opts)), - Inform("Listing policies", []), - display_info_list(rpc_call(Node, rabbit_policy, list_formatted, [VHostArg]), - rabbit_policy:info_keys()); action(report, Node, _Args, _Opts, Inform) -> Inform("Reporting server status on ~p~n~n", [erlang:universaltime()]), @@ -493,7 +481,113 @@ end; {error, E, _} -> {error_string, format_parse_error(E)} - end. + end; + +action(Command, Node, Args, Opts, Inform) -> + %% For backward compatibility, run commands accepting a timeout with + %% the default timeout. + action(Command, Node, Args, Opts, Inform, ?RPC_TIMEOUT). + +action(purge_queue, _Node, [], _Opts, _Inform, _Timeout) -> + {error, "purge_queue takes queue name as an argument"}; + +action(purge_queue, Node, [Q], Opts, Inform, Timeout) -> + VHost = proplists:get_value(?VHOST_OPT, Opts), + QRes = rabbit_misc:r(list_to_binary(VHost), queue, list_to_binary(Q)), + Inform("Purging ~s", [rabbit_misc:rs(QRes)]), + rpc_call(Node, rabbit_control_main, purge_queue, [QRes], Timeout); + +action(list_users, Node, [], _Opts, Inform, Timeout) -> + Inform("Listing users", []), + display_info_list( + call(Node, {rabbit_auth_backend_internal, list_users, []}, Timeout), + rabbit_auth_backend_internal:user_info_keys()); + +action(list_permissions, Node, [], Opts, Inform, Timeout) -> + VHost = proplists:get_value(?VHOST_OPT, Opts), + Inform("Listing permissions in vhost \"~s\"", [VHost]), + display_info_list(call(Node, {rabbit_auth_backend_internal, + list_vhost_permissions, [VHost]}, Timeout), + rabbit_auth_backend_internal:vhost_perms_info_keys()); + +action(list_parameters, Node, [], Opts, Inform, Timeout) -> + VHostArg = list_to_binary(proplists:get_value(?VHOST_OPT, Opts)), + Inform("Listing runtime parameters", []), + display_info_list( + rpc_call(Node, rabbit_runtime_parameters, list_formatted, [VHostArg], + Timeout), + rabbit_runtime_parameters:info_keys()); + +action(list_policies, Node, [], Opts, Inform, Timeout) -> + VHostArg = list_to_binary(proplists:get_value(?VHOST_OPT, Opts)), + Inform("Listing policies", []), + display_info_list(rpc_call(Node, rabbit_policy, list_formatted, [VHostArg], + Timeout), + rabbit_policy:info_keys()); + +action(list_vhosts, Node, Args, _Opts, Inform, Timeout) -> + Inform("Listing vhosts", []), + ArgAtoms = default_if_empty(Args, [name]), + display_info_list(call(Node, {rabbit_vhost, info_all, []}, Timeout), + ArgAtoms); + +action(list_user_permissions, _Node, _Args = [], _Opts, _Inform, _Timeout) -> + {error_string, + "list_user_permissions expects a username argument, but none provided."}; +action(list_user_permissions, Node, Args = [_Username], _Opts, Inform, Timeout) -> + Inform("Listing permissions for user ~p", Args), + display_info_list(call(Node, {rabbit_auth_backend_internal, + list_user_permissions, Args}, Timeout), + rabbit_auth_backend_internal:user_perms_info_keys()); + +action(list_queues, Node, Args, Opts, Inform, Timeout) -> + Inform("Listing queues", []), + VHostArg = list_to_binary(proplists:get_value(?VHOST_OPT, Opts)), + ArgAtoms = default_if_empty(Args, [name, messages]), + display_info_list(rpc_call(Node, rabbit_amqqueue, info_all, + [VHostArg, ArgAtoms], Timeout), + ArgAtoms); + +action(list_exchanges, Node, Args, Opts, Inform, Timeout) -> + Inform("Listing exchanges", []), + VHostArg = list_to_binary(proplists:get_value(?VHOST_OPT, Opts)), + ArgAtoms = default_if_empty(Args, [name, type]), + display_info_list(rpc_call(Node, rabbit_exchange, info_all, + [VHostArg, ArgAtoms], Timeout), + ArgAtoms); + +action(list_bindings, Node, Args, Opts, Inform, Timeout) -> + Inform("Listing bindings", []), + VHostArg = list_to_binary(proplists:get_value(?VHOST_OPT, Opts)), + ArgAtoms = default_if_empty(Args, [source_name, source_kind, + destination_name, destination_kind, + routing_key, arguments]), + display_info_list(rpc_call(Node, rabbit_binding, info_all, + [VHostArg, ArgAtoms], Timeout), + ArgAtoms); + +action(list_connections, Node, Args, _Opts, Inform, Timeout) -> + Inform("Listing connections", []), + ArgAtoms = default_if_empty(Args, [user, peer_host, peer_port, state]), + display_info_list(rpc_call(Node, rabbit_networking, connection_info_all, + [ArgAtoms], Timeout), + ArgAtoms); + +action(list_channels, Node, Args, _Opts, Inform, Timeout) -> + Inform("Listing channels", []), + ArgAtoms = default_if_empty(Args, [pid, user, consumer_count, + messages_unacknowledged]), + display_info_list(rpc_call(Node, rabbit_channel, info_all, [ArgAtoms], + Timeout), + ArgAtoms); + +action(list_consumers, Node, _Args, Opts, Inform, Timeout) -> + Inform("Listing consumers", []), + VHostArg = list_to_binary(proplists:get_value(?VHOST_OPT, Opts)), + display_info_list(rpc_call(Node, rabbit_amqqueue, consumers_all, [VHostArg], + Timeout), + rabbit_amqqueue:consumer_info_keys()). + format_parse_error({_Line, Mod, Err}) -> lists:flatten(Mod:format_error(Err)). @@ -505,6 +599,13 @@ rabbit_amqqueue:with( Q, fun(#amqqueue{pid = QPid}) -> rabbit_amqqueue:cancel_sync_mirrors(QPid) + end). + +purge_queue(Q) -> + rabbit_amqqueue:with( + Q, fun(Q1) -> + rabbit_amqqueue:purge(Q1), + ok end). %%---------------------------------------------------------------------------- @@ -650,6 +751,9 @@ call(Node, {Mod, Fun, Args}) -> rpc_call(Node, Mod, Fun, lists:map(fun list_to_binary_utf8/1, Args)). +call(Node, {Mod, Fun, Args}, Timeout) -> + rpc_call(Node, Mod, Fun, lists:map(fun list_to_binary_utf8/1, Args), Timeout). + list_to_binary_utf8(L) -> B = list_to_binary(L), case rabbit_binary_parser:validate_utf8(B) of diff --git a/src/rabbit_dead_letter.erl b/src/rabbit_dead_letter.erl index 0102880..29032df 100644 --- a/src/rabbit_dead_letter.erl +++ b/src/rabbit_dead_letter.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_dead_letter). @@ -78,40 +78,99 @@ content = Content2}. -x_death_event_key(Info, Key, KeyType) -> +x_death_event_key(Info, Key) -> case lists:keysearch(Key, 1, Info) of - false -> undefined; - {value, {Key, KeyType, Val}} -> Val - end. + false -> undefined; + {value, {Key, _KeyType, Val}} -> Val + end. + +maybe_append_to_event_group(Table, _Key, _SeenKeys, []) -> + [Table]; +maybe_append_to_event_group(Table, {_Queue, _Reason} = Key, SeenKeys, Acc) -> + case sets:is_element(Key, SeenKeys) of + true -> Acc; + false -> [Table | Acc] + end. + +group_by_queue_and_reason([]) -> + []; +group_by_queue_and_reason([Table]) -> + [Table]; +group_by_queue_and_reason(Tables) -> + {_, Grouped} = + lists:foldl( + fun ({table, Info}, {SeenKeys, Acc}) -> + Q = x_death_event_key(Info, <<"queue">>), + R = x_death_event_key(Info, <<"reason">>), + Matcher = queue_and_reason_matcher(Q, R), + {Matches, _} = lists:partition(Matcher, Tables), + {Augmented, N} = case Matches of + [X] -> {X, 1}; + [X|_] = Xs -> {X, length(Xs)} + end, + Key = {Q, R}, + Acc1 = maybe_append_to_event_group( + ensure_xdeath_event_count(Augmented, N), + Key, SeenKeys, Acc), + {sets:add_element(Key, SeenKeys), Acc1} + end, {sets:new(), []}, Tables), + Grouped. update_x_death_header(Info, Headers) -> - Q = x_death_event_key(Info, <<"queue">>, longstr), - R = x_death_event_key(Info, <<"reason">>, longstr), + Q = x_death_event_key(Info, <<"queue">>), + R = x_death_event_key(Info, <<"reason">>), case rabbit_basic:header(<<"x-death">>, Headers) of undefined -> - rabbit_basic:prepend_table_header(<<"x-death">>, + rabbit_basic:prepend_table_header( + <<"x-death">>, [{<<"count">>, long, 1} | Info], Headers); {<<"x-death">>, array, Tables} -> + %% group existing x-death headers in case we have some from + %% before rabbitmq-server#78 + GroupedTables = group_by_queue_and_reason(Tables), {Matches, Others} = lists:partition( - fun ({table, Info0}) -> - x_death_event_key(Info0, <<"queue">>, longstr) =:= Q - andalso x_death_event_key(Info0, <<"reason">>, longstr) =:= R - end, Tables), + queue_and_reason_matcher(Q, R), + GroupedTables), Info1 = case Matches of [] -> [{<<"count">>, long, 1} | Info]; [{table, M}] -> - case x_death_event_key(M, <<"count">>, long) of - undefined -> - [{<<"count">>, long, 1} | M]; - N -> - lists:keyreplace( - <<"count">>, 1, M, - {<<"count">>, long, N + 1}) - end + increment_xdeath_event_count(M) end, - rabbit_misc:set_table_value(Headers, <<"x-death">>, array, + rabbit_misc:set_table_value( + Headers, <<"x-death">>, array, [{table, rabbit_misc:sort_field_table(Info1)} | Others]) + end. + +ensure_xdeath_event_count({table, Info}, InitialVal) when InitialVal >= 1 -> + {table, ensure_xdeath_event_count(Info, InitialVal)}; +ensure_xdeath_event_count(Info, InitialVal) when InitialVal >= 1 -> + case x_death_event_key(Info, <<"count">>) of + undefined -> + [{<<"count">>, long, InitialVal} | Info]; + _ -> + Info + end. + +increment_xdeath_event_count(Info) -> + case x_death_event_key(Info, <<"count">>) of + undefined -> + [{<<"count">>, long, 1} | Info]; + N -> + lists:keyreplace( + <<"count">>, 1, Info, + {<<"count">>, long, N + 1}) + end. + +queue_and_reason_matcher(Q, R) -> + F = fun(Info) -> + x_death_event_key(Info, <<"queue">>) =:= Q + andalso x_death_event_key(Info, <<"reason">>) =:= R + end, + fun({table, Info}) -> + F(Info); + (Info) when is_list(Info) -> + F(Info) end. per_msg_ttl_header(#'P_basic'{expiration = undefined}) -> @@ -178,7 +237,7 @@ true -> ok; undefined -> rabbit_log:warning( "Message dropped. Dead-letter queues cycle detected" ++ - ": ~p~nThis cycle will NOT be reported again.~n", + ": ~p~nThis cycle will NOT be reported again.~n", [Queues]), put(Key, true) end. diff --git a/src/rabbit_diagnostics.erl b/src/rabbit_diagnostics.erl index 9fc0fab..531f3f9 100644 --- a/src/rabbit_diagnostics.erl +++ b/src/rabbit_diagnostics.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_diagnostics). diff --git a/src/rabbit_direct.erl b/src/rabbit_direct.erl index 11233e7..d79ef4a 100644 --- a/src/rabbit_direct.erl +++ b/src/rabbit_direct.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_direct). diff --git a/src/rabbit_disk_monitor.erl b/src/rabbit_disk_monitor.erl index 031a04f..518000e 100644 --- a/src/rabbit_disk_monitor.erl +++ b/src/rabbit_disk_monitor.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_disk_monitor). diff --git a/src/rabbit_epmd_monitor.erl b/src/rabbit_epmd_monitor.erl index 2615549..5b06237 100644 --- a/src/rabbit_epmd_monitor.erl +++ b/src/rabbit_epmd_monitor.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_epmd_monitor). diff --git a/src/rabbit_error_logger.erl b/src/rabbit_error_logger.erl index c2fd3c1..eecb2d6 100644 --- a/src/rabbit_error_logger.erl +++ b/src/rabbit_error_logger.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_error_logger). diff --git a/src/rabbit_error_logger_file_h.erl b/src/rabbit_error_logger_file_h.erl index 5f9a21e..65ab7fc 100644 --- a/src/rabbit_error_logger_file_h.erl +++ b/src/rabbit_error_logger_file_h.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_error_logger_file_h). diff --git a/src/rabbit_event.erl b/src/rabbit_event.erl index a33103f..13bf6bc 100644 --- a/src/rabbit_event.erl +++ b/src/rabbit_event.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_event). diff --git a/src/rabbit_exchange.erl b/src/rabbit_exchange.erl index 5448cb0..4593344 100644 --- a/src/rabbit_exchange.erl +++ b/src/rabbit_exchange.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_exchange). diff --git a/src/rabbit_exchange_decorator.erl b/src/rabbit_exchange_decorator.erl index 900f9c3..7c5bfdf 100644 --- a/src/rabbit_exchange_decorator.erl +++ b/src/rabbit_exchange_decorator.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_exchange_decorator). diff --git a/src/rabbit_exchange_type.erl b/src/rabbit_exchange_type.erl index 4dd3442..92c1de6 100644 --- a/src/rabbit_exchange_type.erl +++ b/src/rabbit_exchange_type.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_exchange_type). diff --git a/src/rabbit_exchange_type_direct.erl b/src/rabbit_exchange_type_direct.erl index 8a240a8..5c4ab3c 100644 --- a/src/rabbit_exchange_type_direct.erl +++ b/src/rabbit_exchange_type_direct.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_exchange_type_direct). diff --git a/src/rabbit_exchange_type_fanout.erl b/src/rabbit_exchange_type_fanout.erl index 3a1f071..67d88d6 100644 --- a/src/rabbit_exchange_type_fanout.erl +++ b/src/rabbit_exchange_type_fanout.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_exchange_type_fanout). diff --git a/src/rabbit_exchange_type_headers.erl b/src/rabbit_exchange_type_headers.erl index afce57d..b56efdf 100644 --- a/src/rabbit_exchange_type_headers.erl +++ b/src/rabbit_exchange_type_headers.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_exchange_type_headers). diff --git a/src/rabbit_exchange_type_invalid.erl b/src/rabbit_exchange_type_invalid.erl index 457f184..283bd49 100644 --- a/src/rabbit_exchange_type_invalid.erl +++ b/src/rabbit_exchange_type_invalid.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_exchange_type_invalid). diff --git a/src/rabbit_exchange_type_topic.erl b/src/rabbit_exchange_type_topic.erl index af00fe8..afbfc65 100644 --- a/src/rabbit_exchange_type_topic.erl +++ b/src/rabbit_exchange_type_topic.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_exchange_type_topic). diff --git a/src/rabbit_file.erl b/src/rabbit_file.erl index 81a617a..6c4f0e5 100644 --- a/src/rabbit_file.erl +++ b/src/rabbit_file.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2011-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2011-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_file). diff --git a/src/rabbit_framing.erl b/src/rabbit_framing.erl index 7f6989d..d5f46e7 100644 --- a/src/rabbit_framing.erl +++ b/src/rabbit_framing.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% TODO auto-generate diff --git a/src/rabbit_guid.erl b/src/rabbit_guid.erl index 5307d7e..0a9fe4d 100644 --- a/src/rabbit_guid.erl +++ b/src/rabbit_guid.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_guid). diff --git a/src/rabbit_heartbeat.erl b/src/rabbit_heartbeat.erl index 36b0baa..9930767 100644 --- a/src/rabbit_heartbeat.erl +++ b/src/rabbit_heartbeat.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_heartbeat). diff --git a/src/rabbit_limiter.erl b/src/rabbit_limiter.erl index 82f4275..5f148a5 100644 --- a/src/rabbit_limiter.erl +++ b/src/rabbit_limiter.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% The purpose of the limiter is to stem the flow of messages from diff --git a/src/rabbit_log.erl b/src/rabbit_log.erl index 6f0865b..083204d 100644 --- a/src/rabbit_log.erl +++ b/src/rabbit_log.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_log). @@ -84,6 +84,7 @@ level(debug) -> 4; level(info) -> 3; level(warning) -> 2; +level(warn) -> 2; level(error) -> 1; level(none) -> 0. diff --git a/src/rabbit_memory_monitor.erl b/src/rabbit_memory_monitor.erl index 451ee1f..7aa29fc 100644 --- a/src/rabbit_memory_monitor.erl +++ b/src/rabbit_memory_monitor.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% @@ -25,7 +25,7 @@ -behaviour(gen_server2). -export([start_link/0, register/2, deregister/1, - report_ram_duration/2, stop/0, conserve_resources/3]). + report_ram_duration/2, stop/0, conserve_resources/3, memory_use/1]). -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). @@ -91,6 +91,19 @@ gen_server2:cast(Pid, {disk_alarm, Conserve}); conserve_resources(_Pid, _Source, _Conserve) -> ok. + +memory_use(bytes) -> + MemoryLimit = vm_memory_monitor:get_memory_limit(), + {erlang:memory(total), case MemoryLimit > 0.0 of + true -> MemoryLimit; + false -> infinity + end}; +memory_use(ratio) -> + MemoryLimit = vm_memory_monitor:get_memory_limit(), + case MemoryLimit > 0.0 of + true -> erlang:memory(total) / MemoryLimit; + false -> infinity + end. %%---------------------------------------------------------------------------- %% Gen_server callbacks @@ -223,11 +236,7 @@ queue_duration_count = Count}) -> {ok, LimitThreshold} = application:get_env(rabbit, vm_memory_high_watermark_paging_ratio), - MemoryLimit = vm_memory_monitor:get_memory_limit(), - MemoryRatio = case MemoryLimit > 0.0 of - true -> erlang:memory(total) / MemoryLimit; - false -> infinity - end, + MemoryRatio = memory_use(ratio), if MemoryRatio =:= infinity -> 0.0; MemoryRatio < LimitThreshold orelse Count == 0 -> diff --git a/src/rabbit_mirror_queue_coordinator.erl b/src/rabbit_mirror_queue_coordinator.erl index 38273e1..77a145a 100644 --- a/src/rabbit_mirror_queue_coordinator.erl +++ b/src/rabbit_mirror_queue_coordinator.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mirror_queue_coordinator). diff --git a/src/rabbit_mirror_queue_master.erl b/src/rabbit_mirror_queue_master.erl index 0c05729..7890128 100644 --- a/src/rabbit_mirror_queue_master.erl +++ b/src/rabbit_mirror_queue_master.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mirror_queue_master). diff --git a/src/rabbit_mirror_queue_misc.erl b/src/rabbit_mirror_queue_misc.erl index ce63f7a..fee8904 100644 --- a/src/rabbit_mirror_queue_misc.erl +++ b/src/rabbit_mirror_queue_misc.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mirror_queue_misc). diff --git a/src/rabbit_mirror_queue_mode.erl b/src/rabbit_mirror_queue_mode.erl index 1724be6..5bb2437 100644 --- a/src/rabbit_mirror_queue_mode.erl +++ b/src/rabbit_mirror_queue_mode.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mirror_queue_mode). diff --git a/src/rabbit_mirror_queue_mode_all.erl b/src/rabbit_mirror_queue_mode_all.erl index ab5fccc..5742cd3 100644 --- a/src/rabbit_mirror_queue_mode_all.erl +++ b/src/rabbit_mirror_queue_mode_all.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mirror_queue_mode_all). diff --git a/src/rabbit_mirror_queue_mode_exactly.erl b/src/rabbit_mirror_queue_mode_exactly.erl index bdbc480..0c0b7a1 100644 --- a/src/rabbit_mirror_queue_mode_exactly.erl +++ b/src/rabbit_mirror_queue_mode_exactly.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mirror_queue_mode_exactly). diff --git a/src/rabbit_mirror_queue_mode_nodes.erl b/src/rabbit_mirror_queue_mode_nodes.erl index 1b32f3b..e63f340 100644 --- a/src/rabbit_mirror_queue_mode_nodes.erl +++ b/src/rabbit_mirror_queue_mode_nodes.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mirror_queue_mode_nodes). diff --git a/src/rabbit_mirror_queue_slave.erl b/src/rabbit_mirror_queue_slave.erl index 96515f5..168e711 100644 --- a/src/rabbit_mirror_queue_slave.erl +++ b/src/rabbit_mirror_queue_slave.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mirror_queue_slave). diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl index 5e9c7ce..ed5b38e 100644 --- a/src/rabbit_misc.erl +++ b/src/rabbit_misc.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_misc). @@ -72,6 +72,7 @@ -export([store_proc_name/1, store_proc_name/2]). -export([moving_average/4]). -export([now_to_ms/1]). +-export([get_env/3]). %% Horrible macro to use in guards -define(IS_BENIGN_EXIT(R), @@ -261,6 +262,7 @@ -spec(now_to_ms/1 :: ({non_neg_integer(), non_neg_integer(), non_neg_integer()}) -> pos_integer()). +-spec(get_env/3 :: (atom(), atom(), term()) -> term()). -endif. %%---------------------------------------------------------------------------- @@ -1096,6 +1098,13 @@ store_proc_name(Type, ProcName) -> store_proc_name({Type, ProcName}). store_proc_name(TypeProcName) -> put(process_name, TypeProcName). +%% application:get_env/3 is only available in R16B01 or later. +get_env(Application, Key, Def) -> + case application:get_env(Application, Key) of + {ok, Val} -> Val; + undefined -> Def + end. + moving_average(_Time, _HalfLife, Next, undefined) -> Next; %% We want the Weight to decrease as Time goes up (since Weight is the diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl index bde4221..d480bef 100644 --- a/src/rabbit_mnesia.erl +++ b/src/rabbit_mnesia.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mnesia). diff --git a/src/rabbit_mnesia_rename.erl b/src/rabbit_mnesia_rename.erl index 2787cb7..2604216 100644 --- a/src/rabbit_mnesia_rename.erl +++ b/src/rabbit_mnesia_rename.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mnesia_rename). diff --git a/src/rabbit_msg_file.erl b/src/rabbit_msg_file.erl index 2f3ccc3..06879b9 100644 --- a/src/rabbit_msg_file.erl +++ b/src/rabbit_msg_file.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_msg_file). diff --git a/src/rabbit_msg_store.erl b/src/rabbit_msg_store.erl index 9e3dd1e..02a3bd0 100644 --- a/src/rabbit_msg_store.erl +++ b/src/rabbit_msg_store.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_msg_store). diff --git a/src/rabbit_msg_store_ets_index.erl b/src/rabbit_msg_store_ets_index.erl index 8af921b..f3257e3 100644 --- a/src/rabbit_msg_store_ets_index.erl +++ b/src/rabbit_msg_store_ets_index.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_msg_store_ets_index). diff --git a/src/rabbit_msg_store_gc.erl b/src/rabbit_msg_store_gc.erl index ebb51cf..3a5b4d0 100644 --- a/src/rabbit_msg_store_gc.erl +++ b/src/rabbit_msg_store_gc.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_msg_store_gc). diff --git a/src/rabbit_msg_store_index.erl b/src/rabbit_msg_store_index.erl index 5d067cc..0c7a37b 100644 --- a/src/rabbit_msg_store_index.erl +++ b/src/rabbit_msg_store_index.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_msg_store_index). diff --git a/src/rabbit_net.erl b/src/rabbit_net.erl index e33c183..1731d48 100644 --- a/src/rabbit_net.erl +++ b/src/rabbit_net.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_net). diff --git a/src/rabbit_networking.erl b/src/rabbit_networking.erl index f5deaef..5d87743 100644 --- a/src/rabbit_networking.erl +++ b/src/rabbit_networking.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_networking). diff --git a/src/rabbit_node_monitor.erl b/src/rabbit_node_monitor.erl index 0f00e66..e3960c5 100644 --- a/src/rabbit_node_monitor.erl +++ b/src/rabbit_node_monitor.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_node_monitor). diff --git a/src/rabbit_nodes.erl b/src/rabbit_nodes.erl index bbe0d35..090aacc 100644 --- a/src/rabbit_nodes.erl +++ b/src/rabbit_nodes.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_nodes). @@ -137,7 +137,8 @@ [{" * TCP connection succeeded but Erlang distribution " "failed~n" " * suggestion: hostname mismatch?~n" - " * suggestion: is the cookie set correctly?", []}]; + " * suggestion: is the cookie set correctly?~n" + " * suggestion: is the Erlang distribution using TLS?", []}]; {error, Reason} -> [{" * can't establish TCP connection, reason: ~s~n" " * suggestion: blocked by firewall?", diff --git a/src/rabbit_parameter_validation.erl b/src/rabbit_parameter_validation.erl index c42bcc4..a54f02b 100644 --- a/src/rabbit_parameter_validation.erl +++ b/src/rabbit_parameter_validation.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_parameter_validation). diff --git a/src/rabbit_plugins.erl b/src/rabbit_plugins.erl index 55f7359..3297032 100644 --- a/src/rabbit_plugins.erl +++ b/src/rabbit_plugins.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2011-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2011-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_plugins). diff --git a/src/rabbit_plugins_main.erl b/src/rabbit_plugins_main.erl index 49f699c..a4d5490 100644 --- a/src/rabbit_plugins_main.erl +++ b/src/rabbit_plugins_main.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2011-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2011-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_plugins_main). diff --git a/src/rabbit_policies.erl b/src/rabbit_policies.erl index cc88765..65f3801 100644 --- a/src/rabbit_policies.erl +++ b/src/rabbit_policies.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_policies). diff --git a/src/rabbit_policy.erl b/src/rabbit_policy.erl index f5d0336..5bf5483 100644 --- a/src/rabbit_policy.erl +++ b/src/rabbit_policy.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_policy). diff --git a/src/rabbit_policy_validator.erl b/src/rabbit_policy_validator.erl index dd05208..7ebea83 100644 --- a/src/rabbit_policy_validator.erl +++ b/src/rabbit_policy_validator.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_policy_validator). diff --git a/src/rabbit_prelaunch.erl b/src/rabbit_prelaunch.erl index a076650..13455ab 100644 --- a/src/rabbit_prelaunch.erl +++ b/src/rabbit_prelaunch.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_prelaunch). diff --git a/src/rabbit_prequeue.erl b/src/rabbit_prequeue.erl index 16e30ca..af96ea9 100644 --- a/src/rabbit_prequeue.erl +++ b/src/rabbit_prequeue.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2010-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_prequeue). diff --git a/src/rabbit_priority_queue.erl b/src/rabbit_priority_queue.erl index e20e4b4..206d674 100644 --- a/src/rabbit_priority_queue.erl +++ b/src/rabbit_priority_queue.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_priority_queue). diff --git a/src/rabbit_queue_collector.erl b/src/rabbit_queue_collector.erl index 70a4da1..734228b 100644 --- a/src/rabbit_queue_collector.erl +++ b/src/rabbit_queue_collector.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_queue_collector). diff --git a/src/rabbit_queue_consumers.erl b/src/rabbit_queue_consumers.erl index 068f89f..ae8481a 100644 --- a/src/rabbit_queue_consumers.erl +++ b/src/rabbit_queue_consumers.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_queue_consumers). diff --git a/src/rabbit_queue_index.erl b/src/rabbit_queue_index.erl index 24dcd23..0c7d7c2 100644 --- a/src/rabbit_queue_index.erl +++ b/src/rabbit_queue_index.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_queue_index). diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl index e324743..d296c41 100644 --- a/src/rabbit_reader.erl +++ b/src/rabbit_reader.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_reader). @@ -196,7 +196,17 @@ log(error, "Error on AMQP connection ~p: ~s~n", [self(), rabbit_misc:format_inet_error(Reason)]); socket_error(Reason) -> - log(error, "Error on AMQP connection ~p:~n~p~n", [self(), Reason]). + Level = + case Reason of + {ssl_upgrade_error, closed} -> + %% The socket was closed while upgrading to SSL. + %% This is presumably a TCP healthcheck, so don't log + %% it unless specified otherwise. + debug; + _ -> + error + end, + log(Level, "Error on AMQP connection ~p:~n~p~n", [self(), Reason]). inet_op(F) -> rabbit_misc:throw_on_error(inet_error, F). @@ -263,12 +273,8 @@ handshake, 8)]}), log(info, "closing AMQP connection ~p (~s)~n", [self(), Name]) catch - Ex -> log(case Ex of - connection_closed_with_no_data_received -> debug; - connection_closed_abruptly -> warning; - _ -> error - end, "closing AMQP connection ~p (~s):~n~p~n", - [self(), Name, Ex]) + Ex -> + log_connection_exception(Name, Ex) after %% We don't call gen_tcp:close/1 here since it waits for %% pending output to be sent, which results in unnecessary @@ -282,6 +288,22 @@ rabbit_event:notify(connection_closed, [{pid, self()}]) end, done. + +log_connection_exception(Name, Ex) -> + Severity = case Ex of + connection_closed_with_no_data_received -> debug; + connection_closed_abruptly -> warning; + _ -> error + end, + log_connection_exception(Severity, Name, Ex). + +log_connection_exception(Severity, Name, {heartbeat_timeout, TimeoutSec}) -> + %% Long line to avoid extra spaces and line breaks in log + log(Severity, "closing AMQP connection ~p (~s):~nMissed heartbeats from client, timeout: ~ps~n", + [self(), Name, TimeoutSec]); +log_connection_exception(Severity, Name, Ex) -> + log(Severity, "closing AMQP connection ~p (~s):~n~p~n", + [self(), Name, Ex]). run({M, F, A}) -> try apply(M, F, A) @@ -345,6 +367,8 @@ State#v1{pending_recv = false}); closed when State#v1.connection_state =:= closed -> ok; + closed when CS =:= pre_init andalso Buf =:= [] -> + stop(tcp_healthcheck, State); closed -> stop(closed, State); {error, Reason} -> @@ -359,7 +383,7 @@ end end. -stop(closed, #v1{connection_state = pre_init} = State) -> +stop(tcp_healthcheck, State) -> %% The connection was closed before any packet was received. It's %% probably a load-balancer healthcheck: don't consider this a %% failure. @@ -421,9 +445,10 @@ throw({handshake_timeout, State#v1.callback}); handle_other(heartbeat_timeout, State = #v1{connection_state = closed}) -> State; -handle_other(heartbeat_timeout, State = #v1{connection_state = S}) -> +handle_other(heartbeat_timeout, + State = #v1{connection = #connection{timeout_sec = T}}) -> maybe_emit_stats(State), - throw({heartbeat_timeout, S}); + throw({heartbeat_timeout, T}); handle_other({'$gen_call', From, {shutdown, Explanation}}, State) -> {ForceTermination, NewState} = terminate(Explanation, State), gen_server:reply(From, ok), diff --git a/src/rabbit_recovery_terms.erl b/src/rabbit_recovery_terms.erl index 9f837cc..1140296 100644 --- a/src/rabbit_recovery_terms.erl +++ b/src/rabbit_recovery_terms.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% We use a gen_server simply so that during the terminate/2 call diff --git a/src/rabbit_registry.erl b/src/rabbit_registry.erl index ad8d0d0..fc016e7 100644 --- a/src/rabbit_registry.erl +++ b/src/rabbit_registry.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_registry). diff --git a/src/rabbit_restartable_sup.erl b/src/rabbit_restartable_sup.erl index 3366bad..516eea9 100644 --- a/src/rabbit_restartable_sup.erl +++ b/src/rabbit_restartable_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_restartable_sup). diff --git a/src/rabbit_router.erl b/src/rabbit_router.erl index fca0175..9692167 100644 --- a/src/rabbit_router.erl +++ b/src/rabbit_router.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_router). diff --git a/src/rabbit_runtime_parameter.erl b/src/rabbit_runtime_parameter.erl index 3a5d960..1d4bc0b 100644 --- a/src/rabbit_runtime_parameter.erl +++ b/src/rabbit_runtime_parameter.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_runtime_parameter). diff --git a/src/rabbit_runtime_parameters.erl b/src/rabbit_runtime_parameters.erl index f78549f..fafd598 100644 --- a/src/rabbit_runtime_parameters.erl +++ b/src/rabbit_runtime_parameters.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_runtime_parameters). diff --git a/src/rabbit_sasl_report_file_h.erl b/src/rabbit_sasl_report_file_h.erl index 2dd1670..c6000a2 100644 --- a/src/rabbit_sasl_report_file_h.erl +++ b/src/rabbit_sasl_report_file_h.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_sasl_report_file_h). diff --git a/src/rabbit_ssl.erl b/src/rabbit_ssl.erl index bd5dcf0..c07a913 100644 --- a/src/rabbit_ssl.erl +++ b/src/rabbit_ssl.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_ssl). diff --git a/src/rabbit_sup.erl b/src/rabbit_sup.erl index c90bb94..537ff8d 100644 --- a/src/rabbit_sup.erl +++ b/src/rabbit_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_sup). diff --git a/src/rabbit_table.erl b/src/rabbit_table.erl index 41bf958..e716345 100644 --- a/src/rabbit_table.erl +++ b/src/rabbit_table.erl @@ -11,14 +11,14 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_table). -export([create/0, create_local_copy/1, wait_for_replicated/0, wait/1, force_load/0, is_present/0, is_empty/0, needs_default_data/0, - check_schema_integrity/0, clear_ram_only_tables/0]). + check_schema_integrity/0, clear_ram_only_tables/0, wait_timeout/0]). -include("rabbit.hrl"). @@ -30,6 +30,7 @@ -spec(create_local_copy/1 :: ('disc' | 'ram') -> 'ok'). -spec(wait_for_replicated/0 :: () -> 'ok'). -spec(wait/1 :: ([atom()]) -> 'ok'). +-spec(wait_timeout/0 :: () -> non_neg_integer() | infinity). -spec(force_load/0 :: () -> 'ok'). -spec(is_present/0 :: () -> boolean()). -spec(is_empty/0 :: () -> boolean()). @@ -73,10 +74,7 @@ wait(TableNames) -> %% We might be in ctl here for offline ops, in which case we can't %% get_env() for the rabbit app. - Timeout = case application:get_env(rabbit, mnesia_table_loading_timeout) of - {ok, T} -> T; - undefined -> 30000 - end, + Timeout = wait_timeout(), case mnesia:wait_for_tables(TableNames, Timeout) of ok -> ok; @@ -84,6 +82,12 @@ throw({error, {timeout_waiting_for_tables, BadTabs}}); {error, Reason} -> throw({error, {failed_waiting_for_tables, Reason}}) + end. + +wait_timeout() -> + case application:get_env(rabbit, mnesia_table_loading_timeout) of + {ok, T} -> T; + undefined -> 30000 end. force_load() -> [mnesia:force_load_table(T) || T <- names()], ok. diff --git a/src/rabbit_trace.erl b/src/rabbit_trace.erl index 9292068..49b1607 100644 --- a/src/rabbit_trace.erl +++ b/src/rabbit_trace.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_trace). diff --git a/src/rabbit_types.erl b/src/rabbit_types.erl index 039568d..3e2b5ba 100644 --- a/src/rabbit_types.erl +++ b/src/rabbit_types.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_types). diff --git a/src/rabbit_upgrade.erl b/src/rabbit_upgrade.erl index 2ab6545..daf39b8 100644 --- a/src/rabbit_upgrade.erl +++ b/src/rabbit_upgrade.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_upgrade). diff --git a/src/rabbit_upgrade_functions.erl b/src/rabbit_upgrade_functions.erl index 16f0b21..4eced3f 100644 --- a/src/rabbit_upgrade_functions.erl +++ b/src/rabbit_upgrade_functions.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_upgrade_functions). diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl index d4e0a04..691e4ce 100644 --- a/src/rabbit_variable_queue.erl +++ b/src/rabbit_variable_queue.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_variable_queue). diff --git a/src/rabbit_version.erl b/src/rabbit_version.erl index 3a04150..d3b2be1 100644 --- a/src/rabbit_version.erl +++ b/src/rabbit_version.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_version). diff --git a/src/rabbit_vhost.erl b/src/rabbit_vhost.erl index 18d4422..9b627ad 100644 --- a/src/rabbit_vhost.erl +++ b/src/rabbit_vhost.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_vhost). diff --git a/src/rabbit_vm.erl b/src/rabbit_vm.erl index 4d613cc..534a888 100644 --- a/src/rabbit_vm.erl +++ b/src/rabbit_vm.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_vm). diff --git a/src/rabbit_writer.erl b/src/rabbit_writer.erl index d42d705..7cba717 100644 --- a/src/rabbit_writer.erl +++ b/src/rabbit_writer.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_writer). diff --git a/src/supervised_lifecycle.erl b/src/supervised_lifecycle.erl index fcfa90b..1010bbb 100644 --- a/src/supervised_lifecycle.erl +++ b/src/supervised_lifecycle.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% Invoke callbacks on startup and termination. diff --git a/src/supervisor2.erl b/src/supervisor2.erl index 57c3bfc..7b9421e 100644 --- a/src/supervisor2.erl +++ b/src/supervisor2.erl @@ -137,7 +137,7 @@ -record(state, {name, strategy :: strategy(), children = [] :: [child_rec()], - dynamics :: ?DICT:?DICT() | ?SET:?SET(), + dynamics :: ?DICT:?DICT() | ?SETS:?SET(), intensity :: non_neg_integer(), period :: pos_integer(), restarts = [], diff --git a/src/tcp_acceptor.erl b/src/tcp_acceptor.erl index 047b85c..75f216c 100644 --- a/src/tcp_acceptor.erl +++ b/src/tcp_acceptor.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(tcp_acceptor). diff --git a/src/tcp_acceptor_sup.erl b/src/tcp_acceptor_sup.erl index 10b10e4..22c886e 100644 --- a/src/tcp_acceptor_sup.erl +++ b/src/tcp_acceptor_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(tcp_acceptor_sup). diff --git a/src/tcp_listener.erl b/src/tcp_listener.erl index 7c464c6..307249a 100644 --- a/src/tcp_listener.erl +++ b/src/tcp_listener.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(tcp_listener). diff --git a/src/tcp_listener_sup.erl b/src/tcp_listener_sup.erl index b3e1c69..94bdecc 100644 --- a/src/tcp_listener_sup.erl +++ b/src/tcp_listener_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(tcp_listener_sup). diff --git a/src/truncate.erl b/src/truncate.erl index 1b4d957..8feae35 100644 --- a/src/truncate.erl +++ b/src/truncate.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(truncate). diff --git a/src/vm_memory_monitor.erl b/src/vm_memory_monitor.erl index 948956a..304518b 100644 --- a/src/vm_memory_monitor.erl +++ b/src/vm_memory_monitor.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% %% In practice Erlang shouldn't be allowed to grow to more than a half diff --git a/src/worker_pool.erl b/src/worker_pool.erl index 71359aa..99b227e 100644 --- a/src/worker_pool.erl +++ b/src/worker_pool.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(worker_pool). diff --git a/src/worker_pool_sup.erl b/src/worker_pool_sup.erl index 89d2ed4..99afd91 100644 --- a/src/worker_pool_sup.erl +++ b/src/worker_pool_sup.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(worker_pool_sup). diff --git a/src/worker_pool_worker.erl b/src/worker_pool_worker.erl index c2d0589..6e66d85 100644 --- a/src/worker_pool_worker.erl +++ b/src/worker_pool_worker.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. %% -module(worker_pool_worker). diff --git a/version.mk b/version.mk index 4e4ff00..fe6e347 100644 --- a/version.mk +++ b/version.mk @@ -1 +1 @@ -VERSION?=3.5.1 +VERSION?=3.5.4