kevsmith (owner)

Revisions

gist: 226417 Download_button fork
public
Public Clone URL: git://gist.github.com/226417.git
Embed All Files: show embed
cheshire_prototype #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
%% @doc Connect to a RabbitMQ server and open a channel
%% @spec login(vhost(), username(), password()) -> {ok, connection(), channel()}
login(VHost, UserName, Password) ->
  cheshire_connect:login(VHost, UserName, Password).
 
%% @doc Disconnect from a RabbitMQ server and open a channel
%% @spec logout(connection(), channel()) -> ok | {error, any()}
logout(Connection, Channel)
 
%% @doc Creates a randomly named queue and binds it to the
%% specified exchange
%% @spec bind_to(channel(), binary()) -> {ok, queuename()} | {error, any()}
bind_to(Channel, ExchangeName)
 
%% @doc Send a message via basic.publish
%% @spec publish(channel(), binary(), binary()) -> ok | {error, any()}
publish(Channel, ExchangeName, Payload)
 
%% @doc Listen for single message
%% @spec consume_one(channel(), binary()) -> any()
consume_one(Channel, QueueName)
 
%% @doc Listen for single message with timeout
%% @spec consume_one(channel(), binary(), integer()) -> any() | {error, timeout}
consume_one(Channel, QueueName, Timeout)
 
 
%% @doc Register a process as a consumer for a given queue
%% @spec register_consumer(channel(), binary()) -> {ok, binary()}, {error, any()}
register_consumer(Channel, QueueName)
 
%% @doc Unregister a consumer for a given queue
%% @spec cancel_consumer(channel(), binary()) -> ok | {error, any()}
cancel_consumer(Channel, ConsumerTag)