Skip to content

Latest commit

 

History

History
38 lines (32 loc) · 1.24 KB

README.md

File metadata and controls

38 lines (32 loc) · 1.24 KB

This repo using rebar3 for managing Erlang applications. Assume that you already had erlang OTP and rebar3 in your machine

Installation

Clone the repo and start the application

git clone https://github.com/htdat148/erlangRabbitMQ.git
cd erlangRabbitMQ
rebar3 shell

Default configuration

Be default, the rabbit application will create 3 exchanges corresponding to 3 type: direct, fanout and topic. Each exchange is a running process supervise by rabbit_sup.erl. The exchange types and name are get from config/sys.config

For example with "direct" exchange: [{name, <<"direct">>}, {type, <<"direct">>}, {process, "direct_exchange_handler"}]

Usage

Add a queue to exchange. A child process will be spawned and manage by exchange process

rabbit_client_api:add_queue_to_exchange(Exchange, Queue).

Bind routing keys to queue

rabbit_client_api:bind_routing_key_to_queue(RoutingKeys, Queue).

Unbind routing keys to queue

rabbit_client_api:unbind_routing_key_to_queue(RoutingKeys, Queue).

Publish/Sending a message

rabbit_client_api:send_msg(ExchangeStr, RoutingKeyStrs, MsgStr).