Java implementation RABBITMQ, installation process included

Source: Internet
Author: User
Tags rabbitmq

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.