summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUILD.in2
-rw-r--r--Makefile19
-rw-r--r--codegen.py34
-rw-r--r--docs/rabbitmq-multi.pod52
-rw-r--r--docs/rabbitmq-server.pod80
-rw-r--r--docs/rabbitmqctl.pod139
-rw-r--r--include/rabbit.hrl13
-rw-r--r--packaging/RPMS/Fedora/README.txt28
-rw-r--r--packaging/RPMS/Fedora/rabbitmq-server.spec15
-rw-r--r--packaging/debs/Debian/Makefile2
-rw-r--r--packaging/debs/Debian/debian/changelog2
-rw-r--r--packaging/debs/Debian/debian/control2
-rw-r--r--packaging/debs/Debian/debian/dirs2
-rw-r--r--packaging/debs/Debian/debian/rules4
-rw-r--r--packaging/generic-unix/Makefile3
-rw-r--r--packaging/windows/Makefile1
-rwxr-xr-xscripts/rabbitmq-multi2
-rw-r--r--scripts/rabbitmq-multi.bat4
-rwxr-xr-xscripts/rabbitmq-server2
-rw-r--r--scripts/rabbitmq-server.bat2
-rwxr-xr-xscripts/rabbitmqctl2
-rw-r--r--scripts/rabbitmqctl.bat2
-rw-r--r--src/rabbit.erl20
-rw-r--r--src/rabbit_access_control.erl14
-rw-r--r--src/rabbit_amqqueue.erl56
-rw-r--r--src/rabbit_channel.erl27
-rw-r--r--src/rabbit_control.erl7
-rw-r--r--src/rabbit_error_logger.erl2
-rw-r--r--src/rabbit_exchange.erl14
-rw-r--r--src/rabbit_misc.erl15
-rw-r--r--src/rabbit_mnesia.erl4
31 files changed, 412 insertions, 159 deletions
diff --git a/BUILD.in b/BUILD.in
index b013bc3c5d..0e70d0e7b3 100644
--- a/BUILD.in
+++ b/BUILD.in
@@ -1,4 +1,4 @@
-Please see http://www.rabbitmq.com/build.html for build
+Please see http://www.rabbitmq.com/build-server.html for build
instructions.
For your convenience, a text copy of these instructions is available
diff --git a/Makefile b/Makefile
index a32a89ea90..2ed64aa513 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,6 @@ EBIN_DIR=ebin
INCLUDE_DIR=include
SOURCES=$(wildcard $(SOURCE_DIR)/*.erl)
TARGETS=$(EBIN_DIR)/rabbit_framing.beam $(patsubst $(SOURCE_DIR)/%.erl, $(EBIN_DIR)/%.beam,$(SOURCES))
-PLT=rabbit.plt
WEB_URL=http://stage.rabbitmq.com/
ifndef USE_SPECS
@@ -47,16 +46,13 @@ $(INCLUDE_DIR)/rabbit_framing.hrl $(SOURCE_DIR)/rabbit_framing.erl: codegen.py $
$(EBIN_DIR)/rabbit.boot $(EBIN_DIR)/rabbit.script: $(EBIN_DIR)/rabbit.app $(EBIN_DIR)/rabbit.rel $(TARGETS)
erl -noshell -eval 'systools:make_script("ebin/rabbit", [{path, ["ebin"]}]), halt().'
-$(PLT): $(TARGETS)
- dialyzer -c $? --output_plt $@ $(shell if [ -f $@ ] ; then echo "--plt $@"; fi)
-
-dialyze: $(PLT)
+dialyze: $(TARGETS)
+ dialyzer -c $?
clean: cleandb
rm -f $(EBIN_DIR)/*.beam
rm -f $(EBIN_DIR)/rabbit.boot $(EBIN_DIR)/rabbit.script
rm -f $(INCLUDE_DIR)/rabbit_framing.hrl $(SOURCE_DIR)/rabbit_framing.erl codegen.pyc
- rm -f $(PLT)
cleandb: stop-node
erl -mnesia dir '"$(MNESIA_DIR)"' -noshell -eval 'lists:foreach(fun file:delete/1, filelib:wildcard(mnesia:system_info(directory) ++ "/*")), halt().'
@@ -106,7 +102,7 @@ generic_stage:
elinks -dump -no-references -no-numbering $(WEB_URL)install.html \
>> $(GENERIC_STAGE_DIR)/INSTALL; \
cp BUILD.in $(GENERIC_STAGE_DIR)/BUILD; \
- elinks -dump -no-references -no-numbering $(WEB_URL)build.html \
+ elinks -dump -no-references -no-numbering $(WEB_URL)build-server.html \
>> $(GENERIC_STAGE_DIR)/BUILD; \
else \
cp INSTALL $(GENERIC_STAGE_DIR); \
@@ -123,6 +119,7 @@ srcdist: distclean
cp codegen.py Makefile dist/$(TARBALL_NAME)
cp -r scripts dist/$(TARBALL_NAME)
+ cp -r docs dist/$(TARBALL_NAME)
chmod 0755 dist/$(TARBALL_NAME)/scripts/*
(cd dist; tar -zcf $(TARBALL_NAME).tar.gz $(TARBALL_NAME))
@@ -137,12 +134,20 @@ distclean: clean
install: all
@[ -n "$(TARGET_DIR)" ] || (echo "Please set TARGET_DIR."; false)
@[ -n "$(SBIN_DIR)" ] || (echo "Please set SBIN_DIR."; false)
+ @[ -n "$(MAN_DIR)" ] || (echo "Please set MAN_DIR."; false)
$(MAKE) VERSION=$(VERSION) GENERIC_STAGE_DIR=$(TARGET_DIR) generic_stage
chmod 0755 scripts/*
mkdir -p $(SBIN_DIR)
+ mkdir -p $(MAN_DIR)/man1
cp scripts/rabbitmq-server $(SBIN_DIR)
cp scripts/rabbitmqctl $(SBIN_DIR)
cp scripts/rabbitmq-multi $(SBIN_DIR)
+ for manpage in docs/*.pod ; do \
+ pod2man -c "RabbitMQ AMQP Server" -d "" -r "" \
+ $$manpage | gzip --best > \
+ $(MAN_DIR)/man1/`echo $$manpage | sed -e 's:docs/\(.*\)\.pod:\1\.1\.gz:g'`; \
+ done
+
rm -f $(TARGET_DIR)/BUILD
diff --git a/codegen.py b/codegen.py
index 242c2418e2..5dbc57c7de 100644
--- a/codegen.py
+++ b/codegen.py
@@ -45,6 +45,22 @@ erlangTypeMap = {
'timestamp': 'timestamp',
}
+# Coming up with a proper encoding of AMQP tables in JSON is too much
+# hassle at this stage. Given that the only default value we are
+# interested in is for the empty table, we only support that.
+def convertTable(d):
+ if len(d) == 0:
+ return "[]"
+ else: raise 'Non-empty table defaults not supported', d
+
+erlangDefaultValueTypeConvMap = {
+ bool : lambda x: str(x).lower(),
+ str : lambda x: "<<\"" + x + "\">>",
+ int : lambda x: str(x),
+ float : lambda x: str(x),
+ dict: convertTable
+}
+
def erlangize(s):
s = s.replace('-', '_')
s = s.replace(' ', '_')
@@ -271,6 +287,15 @@ def genHrl(spec):
def fieldNameList(fields):
return ', '.join([erlangize(f.name) for f in fields])
+
+ def fieldNameListDefaults(fields):
+ def fillField(field):
+ result = erlangize(f.name)
+ if field.defaultvalue != None:
+ conv_fn = erlangDefaultValueTypeConvMap[type(field.defaultvalue)]
+ result += ' = ' + conv_fn(field.defaultvalue)
+ return result
+ return ', '.join([fillField(f) for f in fields])
methods = spec.allMethods()
@@ -283,23 +308,18 @@ def genHrl(spec):
print "%% Method field records."
for m in methods:
- print "-record(%s, {%s})." % (m.erlangName(), fieldNameList(m.arguments))
+ print "-record(%s, {%s})." % (m.erlangName(), fieldNameListDefaults(m.arguments))
print "%% Class property records."
for c in spec.allClasses():
print "-record('P_%s', {%s})." % (erlangize(c.name), fieldNameList(c.fields))
-#---------------------------------------------------------------------------
-
def generateErl(specPath):
genErl(AmqpSpec(specPath))
def generateHrl(specPath):
genHrl(AmqpSpec(specPath))
-
+
if __name__ == "__main__":
do_main(generateHrl, generateErl)
-
-
-
diff --git a/docs/rabbitmq-multi.pod b/docs/rabbitmq-multi.pod
new file mode 100644
index 0000000000..2e3f28c8fc
--- /dev/null
+++ b/docs/rabbitmq-multi.pod
@@ -0,0 +1,52 @@
+=head1 NAME
+
+rabbitmq-multi - start/stop local cluster RabbitMQ nodes
+
+=head1 SYNOPSIS
+
+rabbitmq-multi I<command> [command option]
+
+=head1 DESCRIPTION
+
+RabbitMQ is an implementation of AMQP, the emerging standard for high
+performance enterprise messaging. The RabbitMQ server is a robust and
+scalable implementation of an AMQP broker.
+
+rabbitmq-multi scripts allows for easy set-up of a cluster on a single
+machine.
+
+See also rabbitmq-server(1) for configuration information.
+
+=head1 COMMANDS
+
+start_all I<count>
+ start count nodes with unique names, listening on all IP addresses
+ and on sequential ports starting from 5672.
+
+stop_all
+ stop all local RabbitMQ nodes
+
+=head1 EXAMPLES
+
+Start 3 local RabbitMQ nodes with unique, sequential port numbers:
+
+ rabbitmq-multi start_all 3
+
+=head1 SEE ALSO
+
+rabbitmq-server(1), rabbitmqctl(1)
+
+=head1 AUTHOR
+
+Originally written by The RabbitMQ Team <info@lshift.net>
+
+=head1 COPYRIGHT
+
+This package, the RabbitMQ server is licensed under the MPL.
+
+If you have any questions regarding licensing, please contact us at
+info@rabbitmq.com.
+
+=head1 REFERENCES
+
+RabbitMQ Web Site: http://www.rabbitmq.com
diff --git a/docs/rabbitmq-server.pod b/docs/rabbitmq-server.pod
new file mode 100644
index 0000000000..1eaf2dfdfb
--- /dev/null
+++ b/docs/rabbitmq-server.pod
@@ -0,0 +1,80 @@
+=head1 NAME
+
+rabbitmq-server - start RabbitMQ AMQP server
+
+=head1 SYNOPSIS
+
+rabbitmq-server [-detached]
+
+=head1 DESCRIPTION
+
+RabbitMQ is an implementation of AMQP, the emerging standard for high
+performance enterprise messaging. The RabbitMQ server is a robust and
+scalable implementation of an AMQP broker.
+
+Running rabbitmq-server in the foreground displays a banner message,
+and reports on progress in the startup sequence, concluding with the
+message "broker running", indicating that the RabbitMQ broker has been
+started successfully. To shut down the server, just terminate the
+process or use rabbitmqctl(1).
+
+=head1 ENVIRONMENT
+
+B<MNESIA_BASE>
+ Defaults to /var/lib/rabbitmq/mnesia. Set this to the directory
+ where Mnesia database files should be placed.
+
+B<LOG_BASE>
+ Defaults to /var/log/rabbitmq. Log files generated by the server
+ will be placed in this directory.
+
+B<NODENAME>
+ Defaults to rabbit. This can be useful if you want to run more
+ than one node per machine - B<NODENAME> should be unique per
+ erlang-node-and-machine combination. See clustering on a single
+ machine guide
+ at http://www.rabbitmq.com/clustering.html#single-machine for
+ details.
+
+B<NODE_IP_ADDRESS>
+ Defaults to 0.0.0.0. This can be changed if you only want to bind
+ to one network interface.
+
+B<NODE_PORT>
+ Defaults to 5672.
+
+B<CLUSTER_CONFIG_FILE>
+ Defaults to /etc/default/rabbitmq_cluster.config. If this file is
+ present it is used by the server to auto-configure a RabbitMQ
+ cluster.
+ See the clustering guide at http://www.rabbitmq.com/clustering.html
+ for details.
+
+=head1 OPTIONS
+
+B<-detached> start the server process in the background
+
+=head1 EXAMPLES
+
+Run RabbitMQ AMQP server in the background:
+
+ rabbitmq-server -detached
+
+=head1 SEE ALSO
+
+rabbitmq-multi(1), rabbitmqctl(1)
+
+=head1 AUTHOR
+
+Originally written by The RabbitMQ Team <info@lshift.net>
+
+=head1 COPYRIGHT
+
+This package, the RabbitMQ server is licensed under the MPL.
+
+If you have any questions regarding licensing, please contact us at
+info@rabbitmq.com.
+
+=head1 REFERENCES
+
+RabbitMQ Web Site: http://www.rabbitmq.com
diff --git a/docs/rabbitmqctl.pod b/docs/rabbitmqctl.pod
new file mode 100644
index 0000000000..db31b62134
--- /dev/null
+++ b/docs/rabbitmqctl.pod
@@ -0,0 +1,139 @@
+=head1 NAME
+
+rabbitmqctl - command line tool for managing a RabbitMQ broker
+
+=head1 SYNOPSIS
+
+rabbitmqctl [-n I<node>] I<<command>> [command options]
+
+=head1 DESCRIPTION
+
+RabbitMQ is an implementation of AMQP, the emerging standard for high
+performance enterprise messaging. The RabbitMQ server is a robust and
+scalable implementation of an AMQP broker.
+
+rabbitmqctl is a command line tool for managing a RabbitMQ broker.
+It performs all actions by connecting to one of the broker's nodes.
+
+
+=head1 OPTIONS
+
+B<-n> I<node>
+ default node is C<rabbit@server>, where server is the local host.
+ On a host named C<server.example.com>, the node name of the RabbitMQ
+ Erlang node will usually be rabbit@server (unless NODENAME has been
+ set to some non-default value at broker startup time).
+ The output of hostname -s is usually the correct suffix to use
+ after the "@" sign. See rabbitmq-server(1) for details of configur-
+ ing the RabbitMQ broker.
+
+
+=head1 COMMANDS
+
+=head2 APPLICATION AND CLUSTER MANAGEMENT
+
+stop
+ stop the Erlang node on which RabbitMQ broker is running.
+
+stop_app
+ stop the RabbitMQ application, leaving the Erlang node running.
+ This command is typically run prior to performing other management
+ actions that require the RabbitMQ application to be stopped,
+ e.g. I<reset>.
+
+start_app
+ start the RabbitMQ application.
+ This command is typically run prior to performing other management
+ actions that require the RabbitMQ application to be stopped,
+ e.g. I<reset>.
+
+status
+ display various information about the RabbitMQ broker, such as
+ whether the RabbitMQ application on the current node, its version
+ number, what nodes are part of the broker, which of these are
+ running.
+
+force
+ return a RabbitMQ node to its virgin state.
+ Removes the node from any cluster it belongs to, removes all data
+ from the management database, such as configured users, vhosts and
+ deletes all persistent messages.
+
+force_reset
+ the same as I<force> command, but resets the node unconditionally,
+ regardless of the current management database state and cluster
+ configuration.
+ It should only be used as a last resort if the database or cluster
+ configuration has been corrupted.
+
+cluster I<clusternode> ...
+ instruct the node to become member of a cluster with the specified
+ nodes determined by I<clusternode> option(s).
+ See http://www.rabbitmq.com/clustering.html for more information
+ about clustering.
+
+=head2 USER MANAGEMENT
+
+add_user I<username> I<password>
+ create a user named I<username> with (initial) password I<password>.
+
+change_password I<username> I<newpassword>
+ change the password for the user named I<username> to I<newpassword>.
+
+list_users
+ list all users.
+
+=head2 ACCESS CONTROL
+
+add_vhost I<vhostpath>
+ create a new virtual host called I<vhostpath>.
+
+delete_vhost I<vhostpath>
+ delete a virtual host I<vhostpath>.
+ That command deletes also all its exchanges, queues and user mappings.
+
+list_vhosts
+ list all virtual hosts.
+
+map_user_vhost I<username> I<vhostpath>
+ grant the user named I<username> access to the virtual host called
+ I<vhostpath>.
+
+unmap_user_vhost I<username> I<vhostpath>
+ deny the user named I<username> access to the virtual host called
+ I<vhostpath>.
+
+list_user_vhost I<username>
+ list all the virtual hosts to which the user named I<username> has
+ been granted access.
+
+=head1 EXAMPLES
+
+Create a user named foo with (initial) password bar at the Erlang node
+rabbit@test:
+
+ rabbitmqctl -n rabbit@test add_user foo bar
+
+Grant user named foo access to the virtual host called test at the
+default Erlang node:
+
+ rabbitmqctl map_user_vhost foo test
+
+=head1 SEE ALSO
+
+rabbitmq-multi(1), rabbitmq-server(1)
+
+=head1 AUTHOR
+
+Originally written by The RabbitMQ Team <info@lshift.net>
+
+=head1 COPYRIGHT
+
+This package, the RabbitMQ server is licensed under the MPL.
+
+If you have any questions regarding licensing, please contact us at
+info@rabbitmq.com.
+
+=head1 REFERENCES
+
+RabbitMQ Web Site: http://www.rabbitmq.com
diff --git a/include/rabbit.hrl b/include/rabbit.hrl
index c23c5664b2..226fa5efca 100644
--- a/include/rabbit.hrl
+++ b/include/rabbit.hrl
@@ -30,11 +30,13 @@
-record(connection, {user, timeout_sec, frame_max, vhost}).
--record(content, {class_id,
- properties, %% either 'none', or a decoded record/tuple
- properties_bin, %% either 'none', or an encoded properties binary
- %% Note: at most one of properties and properties_bin can be 'none' at once.
- payload_fragments_rev %% list of binaries, in reverse order (!)
+-record(content,
+ {class_id,
+ properties, %% either 'none', or a decoded record/tuple
+ properties_bin, %% either 'none', or an encoded properties binary
+ %% Note: at most one of properties and properties_bin can be
+ %% 'none' at once.
+ payload_fragments_rev %% list of binaries, in reverse order (!)
}).
-record(resource, {virtual_host, kind, name}).
@@ -82,7 +84,6 @@
-type(user() ::
#user{username :: username(),
password :: password()}).
--type(permission() :: 'passive' | 'active' | 'write' | 'read').
-type(amqqueue() ::
#amqqueue{name :: queue_name(),
durable :: bool(),
diff --git a/packaging/RPMS/Fedora/README.txt b/packaging/RPMS/Fedora/README.txt
index a7db530b24..6f31325970 100644
--- a/packaging/RPMS/Fedora/README.txt
+++ b/packaging/RPMS/Fedora/README.txt
@@ -1,8 +1,7 @@
Notes on creating rpms for rabbitmq
-Assuming that rpm will be built under $TOP_DIR/rpm
-directory the rpm macros configuration file
-would look like:
+Assuming that rpm will be built under $TOP_DIR/rpm,
+the main configuration variables would look like:
%_topdir $TOP_DIR/rpm
%_tmppath $TOP_DIR/rpm/tmp
@@ -11,11 +10,7 @@ would look like:
%_includedir /usr/include
%_mandir /usr/share/man
-Where $TOP_DIR can be any directory (usually $HOME)
-However this configuration has to be under the following
-path:
-$HOME/.rpmmacros
-since this is a fixed place where rpmbuild looks for macros.
+Where $TOP_DIR can be any directory (default is $HOME).
The $TOP_DIR/rpm directory has following structure:
@@ -24,14 +19,14 @@ rpm
+---- SOURCES // where source tarballs are put
+---- SPECS // directory containing specs
+---- SRPMS // rpmbuild puts here srpms
- +---- RPMS // rpmbuils puts here rpms
- +---- tmp // where rpm packages are built
+ +---- RPMS // rpmbuils puts here rpms
+ +---- tmp // where rpm packages are built
Makefile will copy the source tarball from fixed directory
specified by $TARBALL_DIR to SOURCES directory and
similarly specs from $SPEC_DIR to SPECS directory.
-'make rpms' should create both client and server rabbitmq.
+'make rpms' should create rabbitmq-server package.
If there are any errors reported by rpmbuild this is
possibly due to incorrect name of the packages
(if all dependencies are satisifed) - different distros
@@ -39,15 +34,16 @@ can have slightly different names.
rpms and srpms are placed in their respective directories.
-'make prepare' will create the necessary structure and
-create the rpmmacros file. Change top variables to adjust
-it to your system. Note that it will *overwrite* any current
-rpmmacros configuration file.
+'make prepare' will create the necessary structure.
+Change main configuration variables specified in the 'DEFINES'
+variable in the Makefile to adjust it to your system.
+Note that it will *overwrite* any current rpmmacros
+configurations.
The first thing to do for building rpms is to create you own
source tarball of AMQ. In the spec files two top variables
determine the name of the tarball. Adjust it to you needs.
-The final name has to match the *Source* tag in specs' headers.
+The final name has to match the *Source* tag in spec's headers.
For information on how to sign the package see:
http://fedoranews.org/tchung/gpg/
diff --git a/packaging/RPMS/Fedora/rabbitmq-server.spec b/packaging/RPMS/Fedora/rabbitmq-server.spec
index ca0b6b8e40..25213816dd 100644
--- a/packaging/RPMS/Fedora/rabbitmq-server.spec
+++ b/packaging/RPMS/Fedora/rabbitmq-server.spec
@@ -20,6 +20,7 @@ scalable implementation of an AMQP broker.
%define _libdir /usr/lib/erlang
%define _docdir /usr/share/doc
+%define _mandir /usr/share/man
%define _maindir $RPM_BUILD_ROOT%{_libdir}/lib/rabbitmq_server-%{main_version}
%define package_name rabbitmq-server-dist
@@ -36,8 +37,10 @@ fi
%build
mkdir %{package_name}
mkdir %{package_name}/sbin
+mkdir %{package_name}/man
make install TARGET_DIR=`pwd`/%{package_name} \
SBIN_DIR=`pwd`/%{package_name}/sbin \
+ MAN_DIR=`pwd`/%{package_name}/man
VERSION=%{main_version}
%install
@@ -45,6 +48,7 @@ mkdir -p %{_maindir}
mkdir -p $RPM_BUILD_ROOT%{_docdir}/rabbitmq-server
mkdir -p $RPM_BUILD_ROOT/etc/init.d
mkdir -p $RPM_BUILD_ROOT/usr/sbin
+mkdir -p $RPM_BUILD_ROOT%{_mandir}
mkdir -p $RPM_BUILD_ROOT/var/lib/rabbitmq/mnesia
mkdir -p $RPM_BUILD_ROOT/var/log/rabbitmq
@@ -55,6 +59,7 @@ cp -r %{package_name}/src %{_maindir}
cp -r %{package_name}/include %{_maindir}
chmod 755 %{package_name}/sbin/*
cp %{package_name}/sbin/* $RPM_BUILD_ROOT/usr/sbin/
+cp -r %{package_name}/man/* $RPM_BUILD_ROOT%{_mandir}/
cp ../init.d $RPM_BUILD_ROOT/etc/init.d/rabbitmq-server
chmod 775 $RPM_BUILD_ROOT/etc/init.d/rabbitmq-server
@@ -63,6 +68,8 @@ mv $RPM_BUILD_ROOT/usr/sbin/rabbitmqctl $RPM_BUILD_ROOT/usr/sbin/rabbitmqctl_rea
cp ../rabbitmqctl_wrapper $RPM_BUILD_ROOT/usr/sbin/rabbitmqctl
chmod 755 $RPM_BUILD_ROOT/usr/sbin/rabbitmqctl
+cp %{buildroot}%{_mandir}/man1/rabbitmqctl.1.gz %{buildroot}%{_mandir}/man1/rabbitmqctl_real.1.gz
+
%post
# create rabbitmq group
if ! getent group rabbitmq >/dev/null; then
@@ -107,10 +114,8 @@ fi
%defattr(-,root,root)
%{_libdir}/lib/rabbitmq_server-%{main_version}/
%{_docdir}/rabbitmq-server/
-/usr/sbin/rabbitmq-server
-/usr/sbin/rabbitmq-multi
-/usr/sbin/rabbitmqctl
-/usr/sbin/rabbitmqctl_real
+%{_mandir}
+/usr/sbin
/var/lib/rabbitmq
/var/log/rabbitmq
/etc/init.d/rabbitmq-server
@@ -119,7 +124,7 @@ fi
rm -rf $RPM_BUILD_ROOT
%changelog
-* Wed Jul 9 2008 Tony Garnock-Jones <tonyg@lshift.net> 1.4.0
+* Thu Jul 24 2008 Tony Garnock-Jones <tonyg@lshift.net> 1.4.0
- New upstream release
* Mon Mar 3 2008 Adrien Pierard <adrian@lshift.net> 1.3.0
diff --git a/packaging/debs/Debian/Makefile b/packaging/debs/Debian/Makefile
index b49094e2a7..aeb958a7c3 100644
--- a/packaging/debs/Debian/Makefile
+++ b/packaging/debs/Debian/Makefile
@@ -20,7 +20,7 @@ package: clean
cp -r debian $(UNPACKED_DIR)
chmod -R a+x $(UNPACKED_DIR)/debian
UNOFFICIAL_RELEASE=$(UNOFFICIAL_RELEASE) VERSION=$(VERSION) ./check-changelog.sh rabbitmq-server $(UNPACKED_DIR)
- cd $(UNPACKED_DIR); dpkg-buildpackage -rfakeroot $(SIGNING)
+ cd $(UNPACKED_DIR); GNUPGHOME=$(GNUPG_PATH)/.gnupg dpkg-buildpackage -rfakeroot $(SIGNING)
rm -rf $(UNPACKED_DIR)
clean:
diff --git a/packaging/debs/Debian/debian/changelog b/packaging/debs/Debian/debian/changelog
index e6b129371e..07f5a8dd41 100644
--- a/packaging/debs/Debian/debian/changelog
+++ b/packaging/debs/Debian/debian/changelog
@@ -2,7 +2,7 @@ rabbitmq-server (1.4.0-1) testing; urgency=low
* New Upstream Release
- -- Tony Garnock-Jones <tonyg@lshift.net> Wed, 09 Jul 2008 14:31:23 +0100
+ -- Tony Garnock-Jones <tonyg@lshift.net> Thu, 24 Jul 2008 13:21:48 +0100
rabbitmq-server (1.3.0-1) testing; urgency=low
diff --git a/packaging/debs/Debian/debian/control b/packaging/debs/Debian/debian/control
index ae698e1edb..df9a330be8 100644
--- a/packaging/debs/Debian/debian/control
+++ b/packaging/debs/Debian/debian/control
@@ -12,4 +12,4 @@ Description: An AMQP server written in Erlang
RabbitMQ is an implementation of AMQP, the emerging standard for high
performance enterprise messaging. The RabbitMQ server is a robust and
scalable implementation of an AMQP broker.
- Homepage: http://www.rabbitmq.com/
+Homepage: http://www.rabbitmq.com/
diff --git a/packaging/debs/Debian/debian/dirs b/packaging/debs/Debian/debian/dirs
index 74ff60e236..0b3f55b955 100644
--- a/packaging/debs/Debian/debian/dirs
+++ b/packaging/debs/Debian/debian/dirs
@@ -1,6 +1,6 @@
usr/lib/erlang/lib
usr/sbin
-usr/share/linda/overrides
+usr/share/man
var/lib/rabbitmq/mnesia
var/log/rabbitmq
diff --git a/packaging/debs/Debian/debian/rules b/packaging/debs/Debian/debian/rules
index 15b0d50a83..6edf27c15a 100644
--- a/packaging/debs/Debian/debian/rules
+++ b/packaging/debs/Debian/debian/rules
@@ -5,7 +5,7 @@ include /usr/share/cdbs/1/class/makefile.mk
RABBIT_LIB=$(DEB_DESTDIR)usr/lib/erlang/lib/rabbitmq_server-$(DEB_UPSTREAM_VERSION)
-DEB_MAKE_INSTALL_TARGET := install TARGET_DIR=$(RABBIT_LIB)/ SBIN_DIR=$(DEB_DESTDIR)usr/sbin
+DEB_MAKE_INSTALL_TARGET := install TARGET_DIR=$(RABBIT_LIB)/ SBIN_DIR=$(DEB_DESTDIR)usr/sbin MAN_DIR=$(DEB_DESTDIR)usr/share/man
DOCDIR=$(DEB_DESTDIR)usr/share/doc/rabbitmq-server/
@@ -14,5 +14,5 @@ install/rabbitmq-server::
rm $(RABBIT_LIB)/LICENSE*
mv $(DEB_DESTDIR)usr/sbin/rabbitmqctl $(DEB_DESTDIR)usr/sbin/rabbitmqctl_real
cp debian/rabbitmqctl_wrapper $(DEB_DESTDIR)usr/sbin/rabbitmqctl
+ cp $(DEB_DESTDIR)usr/share/man/man1/rabbitmqctl.1.gz $(DEB_DESTDIR)usr/share/man/man1/rabbitmqctl_real.1.gz
chmod a+x $(DEB_DESTDIR)usr/sbin/rabbitmqctl
- echo "Tag: usr-lib-in-arch-all" > $(DEB_DESTDIR)usr/share/linda/overrides/rabbitmq-server
diff --git a/packaging/generic-unix/Makefile b/packaging/generic-unix/Makefile
index 132575226c..b398869693 100644
--- a/packaging/generic-unix/Makefile
+++ b/packaging/generic-unix/Makefile
@@ -7,11 +7,10 @@ dist:
make -C ../.. VERSION=$(VERSION) srcdist
tar -zxvf ../../dist/$(SOURCE_DIR).tar.gz
- mkdir $(TARGET_DIR)
- mkdir $(TARGET_DIR)/sbin
make -C $(SOURCE_DIR) \
TARGET_DIR=`pwd`/$(TARGET_DIR) \
SBIN_DIR=`pwd`/$(TARGET_DIR)/sbin \
+ MAN_DIR=`pwd`/$(TARGET_DIR)/share/man \
install
tar -zcf $(TARGET_TARBALL).tar.gz $(TARGET_DIR)
diff --git a/packaging/windows/Makefile b/packaging/windows/Makefile
index 077461c5e0..f9437da7ca 100644
--- a/packaging/windows/Makefile
+++ b/packaging/windows/Makefile
@@ -15,6 +15,7 @@ dist:
rm -rf $(SOURCE_DIR)/scripts
rm -rf $(SOURCE_DIR)/codegen* $(SOURCE_DIR)/Makefile
rm -f $(SOURCE_DIR)/BUILD
+ rm -rf $(SOURCE_DIR)/docs
mv $(SOURCE_DIR) $(TARGET_DIR)
zip -r $(TARGET_ZIP).zip $(TARGET_DIR)
diff --git a/scripts/rabbitmq-multi b/scripts/rabbitmq-multi
index 4709ca0b43..5e4f4b3862 100755
--- a/scripts/rabbitmq-multi
+++ b/scripts/rabbitmq-multi
@@ -36,7 +36,7 @@ SCRIPT_HOME=$(dirname $0)
export NODENAME NODE_IP_ADDRESS NODE_PORT SCRIPT_HOME PIDS_FILE
exec erl \
- -pa ../ebin \
+ -pa "`dirname $0`/../ebin" \
-noinput \
-hidden \
${ERL_ARGS} \
diff --git a/scripts/rabbitmq-multi.bat b/scripts/rabbitmq-multi.bat
index 34e34ef9ee..819c99af5c 100644
--- a/scripts/rabbitmq-multi.bat
+++ b/scripts/rabbitmq-multi.bat
@@ -41,7 +41,7 @@ if "%NODE_PORT%"=="" (
)
set PIDS_FILE=%RABBITMQ_BASE%\rabbitmq.pids
-set SCRIPT_HOME=.
+set SCRIPT_HOME=%~dp0%
if "%ERLANG_HOME%"=="" (
set ERLANG_HOME=%~dp0%..\..\..
@@ -59,5 +59,5 @@ if not exist "%ERLANG_HOME%\bin\erl.exe" (
exit /B
)
-"%ERLANG_HOME%\bin\erl.exe" -pa ../ebin -noinput -hidden -sname rabbitmq_multi -s rabbit_multi %START_ARGS% -extra %*
+"%ERLANG_HOME%\bin\erl.exe" -pa "%~dp0..\ebin" -noinput -hidden -sname rabbitmq_multi -s rabbit_multi %START_ARGS% -extra %*
diff --git a/scripts/rabbitmq-server b/scripts/rabbitmq-server
index a44dd6da24..e5fb93cc62 100755
--- a/scripts/rabbitmq-server
+++ b/scripts/rabbitmq-server
@@ -51,7 +51,7 @@ else
fi
erl \
- -pa $(dirname $0)/../ebin \
+ -pa "`dirname $0`/../ebin" \
${START_RABBIT} \
-sname ${NODENAME} \
-boot start_sasl \
diff --git a/scripts/rabbitmq-server.bat b/scripts/rabbitmq-server.bat
index 46f4bd923e..8b06c0b4fe 100644
--- a/scripts/rabbitmq-server.bat
+++ b/scripts/rabbitmq-server.bat
@@ -92,7 +92,7 @@ set CLUSTER_CONFIG=-rabbit cluster_config \""%CLUSTER_CONFIG_FILE:\=/%"\"
set MNESIA_DIR=%MNESIA_BASE%/%NODENAME%-mnesia
"%ERLANG_HOME%\bin\erl.exe" ^
--pa ..\ebin ^
+-pa "%~dp0..\ebin" ^
-noinput ^
-boot start_sasl ^
-sname %NODENAME% ^
diff --git a/scripts/rabbitmqctl b/scripts/rabbitmqctl
index eb359dad1f..419dcf632a 100755
--- a/scripts/rabbitmqctl
+++ b/scripts/rabbitmqctl
@@ -31,7 +31,7 @@ ERL_ARGS=
MNESIA_DIR=${MNESIA_BASE}/${NODENAME}
exec erl \
- -pa ../ebin \
+ -pa "`dirname $0`/../ebin" \
-noinput \
-hidden \
${ERL_ARGS} \
diff --git a/scripts/rabbitmqctl.bat b/scripts/rabbitmqctl.bat
index b34adebe06..1ee7e825b9 100644
--- a/scripts/rabbitmqctl.bat
+++ b/scripts/rabbitmqctl.bat
@@ -40,4 +40,4 @@ if not exist "%ERLANG_HOME%\bin\erl.exe" (
exit /B
)
-"%ERLANG_HOME%\bin\erl.exe" -pa ..\ebin -noinput -hidden -sname rabbitmqctl -s rabbit_control -extra %*
+"%ERLANG_HOME%\bin\erl.exe" -pa "%~dp0..\ebin" -noinput -hidden -sname rabbitmqctl -s rabbit_control -extra %*
diff --git a/src/rabbit.erl b/src/rabbit.erl
index 2cd04d0ae1..9ab6b1a68c 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -98,7 +98,7 @@ manage_applications(Iterate, Do, Undo, SkipError, ErrorTag, Apps) ->
end
end, [], Apps),
ok.
-
+
start_applications(Apps) ->
manage_applications(fun lists:foldl/3,
fun application:start/1,
@@ -128,9 +128,9 @@ start(normal, []) ->
io:format("starting ~-20s ...", [Msg]),
Thunk(),
io:format("done~n");
- ({Msg, M, F, A}) ->
+ ({Msg, M, F, A}) ->
io:format("starting ~-20s ...", [Msg]),
- apply(M, F, A),
+ apply(M, F, A),
io:format("done~n")
end,
[{"database",
@@ -154,8 +154,8 @@ start(normal, []) ->
ok = rabbit_amqqueue:recover()
end},
{"persister",
- fun () ->
- ok = start_child(rabbit_persister)
+ fun () ->
+ ok = start_child(rabbit_persister)
end},
{"builtin applications",
fun () ->
@@ -213,12 +213,8 @@ insert_default_data() ->
{ok, DefaultPass} = application:get_env(default_pass),
{ok, DefaultVHost} = application:get_env(default_vhost),
ok = rabbit_access_control:add_vhost(DefaultVHost),
- ok = insert_default_user(DefaultUser, DefaultPass,DefaultVHost),
- ok.
-
-insert_default_user(Username, Password, VHostPath) ->
- ok = rabbit_access_control:add_user(Username, Password),
- ok = rabbit_access_control:map_user_vhost(Username, VHostPath),
+ ok = rabbit_access_control:add_user(DefaultUser, DefaultPass),
+ ok = rabbit_access_control:map_user_vhost(DefaultUser, DefaultVHost),
ok.
start_builtin_amq_applications() ->
@@ -257,7 +253,7 @@ error_log_location() ->
end.
sasl_log_location() ->
- case application:get_env(sasl, sasl_error_logger) of
+ case application:get_env(sasl, sasl_error_logger) of
{ok, {file, File}} -> File;
{ok, false} -> undefined;
{ok, tty} -> tty;
diff --git a/src/rabbit_access_control.erl b/src/rabbit_access_control.erl
index a53ea30795..4342e15b3b 100644
--- a/src/rabbit_access_control.erl
+++ b/src/rabbit_access_control.erl
@@ -82,7 +82,7 @@ check_login(<<"AMQPLAIN">>, Response) ->
[LoginTable])
end;
-check_login(Mechanism, _Response) ->
+check_login(Mechanism, _Response) ->
rabbit_misc:protocol_error(
access_refused, "unsupported authentication mechanism '~s'",
[Mechanism]).
@@ -173,10 +173,14 @@ add_vhost(VHostPath) ->
case mnesia:read({vhost, VHostPath}) of
[] ->
ok = mnesia:write(#vhost{virtual_host = VHostPath}),
- #exchange{} = rabbit_exchange:declare(rabbit_misc:r(VHostPath,exchange,<<"">>), direct, true, false, []),
- #exchange{} = rabbit_exchange:declare(rabbit_misc:r(VHostPath,exchange,<<"amq.direct">>), direct, true, false, []),
- #exchange{} = rabbit_exchange:declare(rabbit_misc:r(VHostPath,exchange,<<"amq.topic">>), topic, true, false, []),
- #exchange{} = rabbit_exchange:declare(rabbit_misc:r(VHostPath,exchange,<<"amq.fanout">>), fanout, true, false, []),
+ [rabbit_exchange:declare(
+ rabbit_misc:r(VHostPath, exchange, Name),
+ Type, true, false, []) ||
+ {Name,Type} <-
+ [{<<"">>, direct},
+ {<<"amq.direct">>, direct},
+ {<<"amq.topic">>, topic},
+ {<<"amq.fanout">>, fanout}]],
ok;
[_] ->
mnesia:abort({vhost_already_exists, VHostPath})
diff --git a/src/rabbit_amqqueue.erl b/src/rabbit_amqqueue.erl
index d7284998cd..1038810345 100644
--- a/src/rabbit_amqqueue.erl
+++ b/src/rabbit_amqqueue.erl
@@ -55,7 +55,7 @@
{'error', 'queue_not_found' | 'exchange_not_found'}).
-spec(start/0 :: () -> 'ok').
-spec(recover/0 :: () -> 'ok').
--spec(declare/4 :: (name(), bool(), bool(), amqp_table()) ->
+-spec(declare/4 :: (queue_name(), bool(), bool(), amqp_table()) ->
amqqueue()).
-spec(add_binding/4 ::
(queue_name(), exchange_name(), routing_key(), amqp_table()) ->
@@ -129,15 +129,15 @@ recover_durable_queues() ->
ok
end).
-declare(Resource = #resource{}, Durable, AutoDelete, Args) ->
- Q = start_queue_process(#amqqueue{name = Resource,
+declare(QueueName, Durable, AutoDelete, Args) ->
+ Q = start_queue_process(#amqqueue{name = QueueName,
durable = Durable,
auto_delete = AutoDelete,
arguments = Args,
pid = none}),
case rabbit_misc:execute_mnesia_transaction(
fun () ->
- case mnesia:wread({amqqueue, Resource}) of
+ case mnesia:wread({amqqueue, QueueName}) of
[] -> ok = recover_queue(Q),
Q;
[ExistingQ] -> ExistingQ
@@ -164,47 +164,7 @@ recover_queue(Q) ->
ok = store_queue(Q),
%ok = recover_bindings(Q),
ok.
-
-% default_binding_spec(#resource{virtual_host = VHostPath, name = Name}) ->
-% #binding{exchange_name = <<"">>,
-% key = Name,
-% queue_name = Name}.
- % #binding_spec{exchange_name = rabbit_misc:r(VHostPath,exchange,<<"">>),
- % routing_key = Name,
- % arguments = []}.
-
-% recover_bindings(Q = #amqqueue{name = QueueName}) ->
-% io:format("Q was ~p~n",[Q]),
-% ok = rabbit_exchange:add_binding(default_binding_spec(QueueName)).
- % lists:foreach(fun (B) ->
- % ok = rabbit_exchange:add_binding(B, Q)
- % end, Specs),
- % ok.
-
-modify_bindings(Queue = #resource{}, X = #resource{}, RoutingKey, Arguments,
- SpecPresentFun, SpecAbsentFun) ->
- exit(modify_bindings).
- % rabbit_misc:execute_mnesia_transaction(
- % fun () ->
- % case mnesia:wread({amqqueue, Queue}) of
- % [Q = #amqqueue{binding_specs = Specs0}] ->
- % Spec = #binding_spec{exchange_name = X,
- % routing_key = RoutingKey,
- % arguments = Arguments},
- % case (case lists:member(Spec, Specs0) of
- % true -> SpecPresentFun;
- % false -> SpecAbsentFun
- % end)(Q, Spec) of
- % {ok, #amqqueue{binding_specs = Specs}} ->
- % {ok, length(Specs)};
- % {error, not_found} ->
- % {error, exchange_not_found};
- % Other -> Other
- % end;
- % [] -> {error, queue_not_found}
- % end
- % end).
-
+
update_bindings(Q = #amqqueue{}, Spec,
UpdateSpecFun, UpdateExchangeFun) ->
exit(update_bindings).
@@ -337,7 +297,7 @@ internal_delete(QueueName) ->
case mnesia:wread({amqqueue, QueueName}) of
[] -> {error, not_found};
[Q] ->
- ok = delete_temp(Q),
+ ok = delete_queue(Q),
ok = mnesia:delete({durable_queues, QueueName}),
ok
end
@@ -362,8 +322,8 @@ on_node_down(Node) ->
node(Pid) == Node]))
end).
-pseudo_queue(NameBin, Pid) ->
- #amqqueue{name = NameBin,
+pseudo_queue(QueueName, Pid) ->
+ #amqqueue{name = QueueName,
durable = false,
auto_delete = false,
arguments = [],
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl
index 73ea552fd6..070760a98a 100644
--- a/src/rabbit_channel.erl
+++ b/src/rabbit_channel.erl
@@ -153,7 +153,8 @@ ok_msg(true, _Msg) -> undefined;
ok_msg(false, Msg) -> Msg.
return_queue_declare_ok(State, NoWait, Q) ->
- NewState = State#ch{most_recently_declared_queue = Q#amqqueue.name},
+ NewState = State#ch{most_recently_declared_queue =
+ (Q#amqqueue.name)#resource.name},
case NoWait of
true -> {noreply, NewState};
false ->
@@ -161,8 +162,7 @@ return_queue_declare_ok(State, NoWait, Q) ->
rabbit_misc:with_exit_handler(
fun () -> {ok, Q#amqqueue.name, 0, 0} end,
fun () -> rabbit_amqqueue:stat(Q) end),
- QueueName = ActualName#resource.name,
- Reply = #'queue.declare_ok'{queue = QueueName,
+ Reply = #'queue.declare_ok'{queue = ActualName#resource.name,
message_count = MessageCount,
consumer_count = ConsumerCount},
{reply, Reply, NewState}
@@ -171,7 +171,9 @@ return_queue_declare_ok(State, NoWait, Q) ->
expand_queue_name_shortcut(<<>>, #ch{ most_recently_declared_queue = <<>> }) ->
rabbit_misc:protocol_error(
not_allowed, "no previously declared queue", []);
-expand_queue_name_shortcut(<<>>, #ch{ most_recently_declared_queue = MRDQ }) -> MRDQ;
+expand_queue_name_shortcut(<<>>, #ch{ virtual_host = VHostPath,
+ most_recently_declared_queue = MRDQ }) ->
+ rabbit_misc:r(VHostPath, queue, MRDQ);
expand_queue_name_shortcut(QueueNameBin, #ch{ virtual_host = VHostPath }) ->
rabbit_misc:r(VHostPath, queue, QueueNameBin).
@@ -227,7 +229,8 @@ handle_method(#'channel.close'{}, _, State = #ch{writer_pid = WriterPid}) ->
ok = rabbit_writer:shutdown(WriterPid),
stop;
-handle_method(#'access.request'{},_, State) -> {reply, #'access.request_ok'{ticket = 1}, State};
+handle_method(#'access.request'{},_, State) ->
+ {reply, #'access.request_ok'{ticket = 1}, State};
handle_method(#'basic.publish'{exchange = ExchangeNameBin,
routing_key = RoutingKey,
@@ -336,7 +339,7 @@ handle_method(#'basic.consume'{queue = QueueNameBin,
ConsumerMapping)}};
{error, queue_owned_by_another_connection} ->
%% The spec is silent on which exception to use
- %% here. This seems reasonable?
+ %% here. This seems reasonable?
%% FIXME: check this
rabbit_misc:protocol_error(
@@ -450,7 +453,6 @@ handle_method(#'exchange.declare'{exchange = ExchangeNameBin,
arguments = Args},
_, State = #ch{ virtual_host = VHostPath }) ->
CheckedType = rabbit_exchange:check_type(TypeNameBin),
- %% FIXME: clarify spec as per declare wrt differing realms
ExchangeName = rabbit_misc:r(VHostPath, exchange, ExchangeNameBin),
X = case rabbit_exchange:lookup(ExchangeName) of
{ok, FoundX} -> FoundX;
@@ -520,7 +522,6 @@ handle_method(#'queue.declare'{queue = QueueNameBin,
end,
Q
end,
- %% FIXME: clarify spec as per declare wrt differing realms
Q = case rabbit_amqqueue:with(
rabbit_misc:r(VHostPath, queue, QueueNameBin),
Finish) of
@@ -530,10 +531,9 @@ handle_method(#'queue.declare'{queue = QueueNameBin,
<<>> -> rabbit_misc:binstring_guid("amq.gen");
Other -> check_name('queue', Other)
end,
- Finish(rabbit_amqqueue:declare(rabbit_misc:r(VHostPath, queue, ActualNameBin),
- Durable,
- AutoDelete,
- Args));
+ QueueName = rabbit_misc:r(VHostPath, queue, ActualNameBin),
+ Finish(rabbit_amqqueue:declare(QueueName,
+ Durable, AutoDelete, Args));
Other -> Other
end,
return_queue_declare_ok(State, NoWait, Q);
@@ -550,7 +550,8 @@ handle_method(#'queue.delete'{queue = QueueNameBin,
if_unused = IfUnused,
if_empty = IfEmpty,
nowait = NoWait
- },_, State) ->
+ },
+ _, State) ->
QueueName = expand_queue_name_shortcut(QueueNameBin, State),
case rabbit_amqqueue:with_or_die(
QueueName,
diff --git a/src/rabbit_control.erl b/src/rabbit_control.erl
index 12040725f9..eb24b78270 100644
--- a/src/rabbit_control.erl
+++ b/src/rabbit_control.erl
@@ -88,13 +88,6 @@ Available commands:
list_user_vhosts <UserName>
list_vhost_users <VHostPath>
- set_permissions <UserName> <VHostPath> <RealmName> [<Permission> ...]
- Permissions management. The available permissions are 'passive',
- 'active', 'write' and 'read', corresponding to the permissions
- referred to in AMQP's \"access.request\" message, or 'all' as an
- abbreviation for all defined permission flags.
- list_permissions <UserName> <VHostPath>
-
<node> should be the name of the master node of the RabbitMQ cluster. It
defaults to the node named \"rabbit\" on the local host. On a host named
\"server.example.com\", the master node will usually be rabbit@server (unless
diff --git a/src/rabbit_error_logger.erl b/src/rabbit_error_logger.erl
index e4ce3aa3df..9220d7b46f 100644
--- a/src/rabbit_error_logger.erl
+++ b/src/rabbit_error_logger.erl
@@ -34,7 +34,7 @@
init([DefaultVHost]) ->
#exchange{} = rabbit_exchange:declare(
- rabbit_misc:r(DefaultVHost,exchange,?LOG_EXCH_NAME),
+ rabbit_misc:r(DefaultVHost, exchange, ?LOG_EXCH_NAME),
topic, true, false, []),
{ok, #resource{virtual_host = DefaultVHost,
kind = exchange,
diff --git a/src/rabbit_exchange.erl b/src/rabbit_exchange.erl
index 89580a0e35..9d8831887b 100644
--- a/src/rabbit_exchange.erl
+++ b/src/rabbit_exchange.erl
@@ -50,7 +50,7 @@
not_found() | {'error', 'unroutable' | 'not_delivered'}).
-spec(recover/0 :: () -> 'ok').
--spec(declare/5 :: (name(), exchange_type(), bool(), bool(),
+-spec(declare/5 :: (exchange_name(), exchange_type(), bool(), bool(),
amqp_table()) -> exchange()).
-spec(check_type/1 :: (binary()) -> atom()).
-spec(assert_type/2 :: (exchange(), atom()) -> 'ok').
@@ -91,15 +91,15 @@ recover_durable_exchanges() ->
end, ok, durable_exchanges)
end).
-declare(Resource = #resource{}, Type, Durable, AutoDelete, Args) ->
- Exchange = #exchange{name = Resource,
+declare(ExchangeName, Type, Durable, AutoDelete, Args) ->
+ Exchange = #exchange{name = ExchangeName,
type = Type,
durable = Durable,
auto_delete = AutoDelete,
arguments = Args},
rabbit_misc:execute_mnesia_transaction(
fun () ->
- case mnesia:wread({exchange, Resource}) of
+ case mnesia:wread({exchange, ExchangeName}) of
[] -> ok = mnesia:write(Exchange),
if Durable ->
ok = mnesia:write(
@@ -132,12 +132,12 @@ assert_type(#exchange{ name = Name, type = ActualType }, RequiredType) ->
lookup(Name) ->
rabbit_misc:dirty_read({exchange, Name}).
-lookup_or_die(Resource = #resource{name = Name}) ->
- case lookup(Resource) of
+lookup_or_die(Name) ->
+ case lookup(Name) of
{ok, X} -> X;
{error, not_found} ->
rabbit_misc:protocol_error(
- not_found, "no ~s", [rabbit_misc:rs(#resource{virtual_host = <<"/">>, kind = exchange, name = Name})])
+ not_found, "no ~s", [rabbit_misc:rs(Name)])
end.
list_vhost_exchanges(VHostPath) ->
diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl
index 6be301e3d5..78de81570d 100644
--- a/src/rabbit_misc.erl
+++ b/src/rabbit_misc.erl
@@ -66,6 +66,7 @@
-spec(get_config/2 :: (atom(), A) -> A).
-spec(set_config/2 :: (atom(), any()) -> 'ok').
-spec(dirty_read/1 :: ({atom(), any()}) -> {'ok', any()} | not_found()).
+-spec(r/3 :: (vhost(), K, name()) -> r(K) when is_subtype(K, atom())).
-spec(r/2 :: (vhost(), K) -> #resource{virtual_host :: vhost(),
kind :: K,
name :: '_'}
@@ -73,16 +74,16 @@
-spec(rs/1 :: (r(atom())) -> string()).
-spec(enable_cover/0 :: () -> 'ok' | {'error', any()}).
-spec(report_cover/0 :: () -> 'ok').
--spec(with_exit_handler/2 :: (thunk(A), thunk(A)) -> A).
--spec(with_user/2 :: (username(), thunk(A)) -> A).
+-spec(with_exit_handler/2 :: (thunk(A), thunk(A)) -> A).
+-spec(with_user/2 :: (username(), thunk(A)) -> A).
-spec(with_vhost/2 :: (vhost(), thunk(A)) -> A).
--spec(with_user_and_vhost/3 :: (username(), vhost(), thunk(A)) -> A).
+-spec(with_user_and_vhost/3 :: (username(), vhost(), thunk(A)) -> A).
-spec(execute_mnesia_transaction/1 :: (thunk(A)) -> A).
--spec(ensure_ok/2 :: ('ok' | {'error', any()}, atom()) -> 'ok').
+-spec(ensure_ok/2 :: ('ok' | {'error', any()}, atom()) -> 'ok').
-spec(localnode/1 :: (atom()) -> node()).
--spec(tcp_name/3 :: (atom(), ip_address(), ip_port()) -> atom()).
+-spec(tcp_name/3 :: (atom(), ip_address(), ip_port()) -> atom()).
-spec(intersperse/2 :: (A, [A]) -> [A]).
--spec(upmap/2 :: (fun ((A) -> B), [A]) -> [B]).
+-spec(upmap/2 :: (fun ((A) -> B), [A]) -> [B]).
-spec(map_in_order/2 :: (fun ((A) -> B), [A]) -> [B]).
-spec(guid/0 :: () -> guid()).
-spec(string_guid/1 :: (any()) -> string()).
@@ -213,7 +214,7 @@ with_user(Username, Thunk) ->
with_vhost(VHostPath, Thunk) ->
fun () ->
case mnesia:read({vhost, VHostPath}) of
- [] ->
+ [] ->
mnesia:abort({no_such_vhost, VHostPath});
[_V] ->
Thunk()
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl
index f7c497f741..3e031c3b31 100644
--- a/src/rabbit_mnesia.erl
+++ b/src/rabbit_mnesia.erl
@@ -241,7 +241,6 @@ init_db(ClusterNodes) ->
ClusterNodes}})
end;
{ok, [_|_]} ->
- ok = ensure_schema_integrity(),
ok = wait_for_tables(),
ok = create_local_table_copies(
case IsDiskNode of
@@ -324,7 +323,8 @@ create_local_table_copy(Tab, Type) ->
end,
ok.
-wait_for_tables() ->
+wait_for_tables() ->
+ ok = ensure_schema_integrity(),
case mnesia:wait_for_tables(table_names(), 30000) of
ok -> ok;
{timeout, BadTabs} ->