RABBITMQ's first Java implementation
RABBITMQ is based on Erlang, so you must first configure the Erlang environment
Erlang official website http://www.erlang.org/
Download options for Erlang under Linux sourcefile
wget command Download
Use tar–xzvf *.tar.gz command to extract under Ubuntu
Execute the following command in turn:
./configure--prefix=/home/hadoop/mydisk/erlang
(This process may fail, recommended sudoapt-get install build-essential)
If not, just install whatever you want.
tip: The following packages are best Erlang Installed prior to installation : Perl, Debhelper (>= 4.0.0), autoconf (>=2.50), OpenSSL, Libssl-dev, M4, Libncurses5-dev, Dpatch, Autotools-dev , Unixodbc-dev
Make
This process will take some time.
Makeinstall
After the installation is complete, you need to do some configuration:
Modify the Etc/profile file to set environment variables
Erlang_home=/home/hadoop/mydisk/erlang Export $ERLANG _home/bin |
Test whether the installation configuration was successful
At this point, Erlang has been installed with the configuration completed and the following begins the installation of configuration RABBITMQ:
Also download the compressed package
Wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.3.5/rabbitmq-server-generic-unix-3.3.5.tar.gz |
Unzip, configure
Start RABBITMQ
Port is 5672
The following RABBITMQ is tested using the Java language, here is a demo
Download the Java Client jar package first
Http://www.rabbitmq.com/java-client.html
Wget http://www.rabbitmq.com/releases/rabbitmq-java-client/v3.3.5/rabbitmq-java-client-bin-3.3.5.tar.gz |
Send Side
You can send a message to a queue by calling the Send method in the main function
Receiving end
This is the receive-side code that receives information from the queue
The default user and default host can be seen through the source code
So the sethost in the above code is commented out, the program has been able to run normally.
Java implementation RABBITMQ, installation process included