Creating a new erlang project based on the rabbitmq erlang client.
Please take these instructions with a giant grain of salt as I am still an erlang noob.
This is how I got started on my CentOS 5 machine.
I installed erlang via yum.
Everything else is installed manually.
First, create a proper folder structure for the new project. This seems to be pretty standard in some of the erlang projects I've seen so far:
project/ project/db/ project/deps/ project/ebin/ project/include/ project/src/
Then install the latest version of rabbitmq and the rabbitmq erlang client like so:
cd deps hg clone http://hg.rabbitmq.com/rabbitmq-server hg clone http://hg.rabbitmq.com/rabbitmq-codegen hg clone http://hg.rabbitmq.com/rabbitmq-erlang-client cd rabbitmq-server && make && cd .. cd rabbitmq-erlang-client && make && cd .. ln -s /path/to/project/deps/rabbitmq-server/ /usr/lib/erlang/lib/rabbitmq_common ln -s /path/to/project/deps/rabbitmq-server/ /usr/lib/erlang/lib/rabbitmq_erlang_client
This downloads and builds rabbitmq and the erlang client to the project's deps/ directory.
Then it links it to erlang's lib directory.
Now it's time to create a makefile to simplify building the code.
Makefile.am
.SUFFIXES: .erl .beam .erl.beam: erlc -W $< ERL = erl -pa ebin -boot start_sasl -s rabbit -mnesia dir 'db' ERLC = erlc -o ebin MODS = src/consumer.erl all: ${ERLC} ${MODS} run: ${ERL} clean: rm -rf ebin/*.beam erl_crash.dump
Now we're ready to go and write a consumer using the erlang client, coming up next.
hi
ReplyDeletethanks for the above summarized information...
please let us know how to write a sample producer and consumer over erlang client...
I have successfully installed the above things but couldn't find any hint for prod and consumers..
thanks in advance
Hi,
ReplyDeleteI've gone ahead and published a post on writing a producer and consumer using the rabbitmq erlang client.
This is the link: http://developingthedream.blogspot.com/2010/08/setting-up-queue-consumer-with.html