Here are some notes I have for maintaining RabbitMQ’s AMQP queues using the Erlang shell.

I am using (for demoing purposes) the RabbitMQ installation that came packaged with the On-Demand Elastic Server generated by CohesiveFT. It couldn’t have been any simpler.

To connect to the RabbitMQ Erlang node, you can pull it up through an SSH session into the Elastic Server (ES) itself or you can remotely connect to the Erlang node from your Erlang node. I will describe how to do both.

Connecting to Erlang from within the server:
sudo su - rabbitmq -s /bin/sh -c 'erl -sname foo -remsh rabbit@srabbitmq'

Connecting remotely to the RabbitMQ Erlang node:
There are a few ways to do this. Since this is just for minor maintenance work on my demo, I do not care about security (if I did, I would prefer setting up ~/.erlang.cookie); therefore, I will connect using the node’s cookie in the following manner:
erl -sname foo -setcookie SOMECOOKIE -remsh rabbit@srabbitmq

The cookie (SOMECOOKIE) is obtained by logging into the ES and running:
cat /var/lib/rabbitmq/.erlang.cookie

For connecting remotely from your Windows workstation, use werl instead of erl so that the -remsh option will work.

When connecting remotely, make sure that port 4369 is open on your ES’s firewall and that the port for the current Erlang session is open (an easy way to determine the port on the ES is by reading the firewall error messages in /var/log/messages for the denied port).

Queue Maintenance


%% "At the erlang prompt, type "rabbit_amqqueue:stat_all().", which will
%% produce a brief report on the status of the queues in the system. This
%% tells you how many there are, how many consumers are listening on each,
%% and how many messages are backlogged on each. There is no indication of
%% how many messages have been through the queues yet." - tonyg


%% This example shows one queue, "my_topic_queue", with a single consumer
%% attached without any messages waiting to be consumed.


(rabbit@srabbitmq)1> rabbit_amqqueue:stat_all().
[{ok,{resource,<<"/">>,queue,<<"my_mytopic_queue">>},0,1}]

%% Specify the queue you want, and bind MyTopicQueue to it.

(rabbit@srabbitmq)2> {ok, MyTopicQueue, _, _ } = lists:nth(1, rabbit_amqqueue:stat_all()).
{ok,{resource,<<"/">>,queue,<<"my_mytopic_queue">>},0,1}

%% Lookup the queue and bind it to AMQ. We will purge this queue later.
(rabbit@srabbitmq)3> {ok, AMQ} = rabbit_amqqueue:lookup(MyTopicQueue).
{ok,{amqqueue,{resource,<<"/">>,queue,<<"my_mytopic_queue">>},
    false,
    true,
    [],
    [{binding_spec,{resource,<<"/">>,exchange,<<"my_topic_exch"...>>},
        <<"US.#">>,
        []}],
    <0.317.0>}}

%% Purge the queue
(rabbit@srabbitmq)4> rabbit_amqqueue:purge(AMQ).
{ok,0}

It’s been a while since I took these notes, so things may have changed since then. I just wanted to share my notes with anyone else starting out with RabbitMQ and also to record them on a public medium for when I may need to access them remotely. Please comment with any necessary corrections.

It’s also been a while (2 years) since my last post.

Page titles are used as descriptors in (social) bookmarking. Consequently, a well formatted page title can speed up the process of finding a bookmark.

Here is the page title format that I find most effective to my bookmarking:
1. Page Name – Domain Name – Date
2. Page Name – Site Name – Date

I prefer domain name over site name, often because it’s usually shorter.
Date is only used when appropriate (blog, news, …). Ex: Dec 6, 2006

Another use for Google Docs

October 20, 2006

I have found Google Docs to be very useful for maintaining a private cheat sheet of some of my favorite, but less memorable vim commands.

Technorati Supports OpenID

October 20, 2006

Technorati will now support OpenID so that it can provide yet another way to claim your blog. And this method does appear to be its quickest.

Now only if the OpenID team can finalize its 2.0 specifications can I start using my i-name in OpenID without having to tack on the xri.net, http proxy.

Dirty Car Art

October 18, 2006

Scott Wade’s Dirty Cart Art Gallery

This sure beats having someone finger “wash me” into the dirt of your car.   Pretty neat stuff.

In or Out?

October 16, 2006

Is Eating Out Cheaper Than Eating In? I often revisit this question on a monthly basis (and its usually whenever the bills are due). I have always preferred eating out, because it’s quick. Other reasons include the fact that I do not enjoy left-overs and that I only cook for one person. So, I usually spend about $7-10 a meal when eating out. That’s almost $20 a day.

I found my most cost and time effective solution to be eating out for dinner and eating in (paper-bagging) for lunch. The reason being is that lunch requires very few ingredients that last for about a week.  Specifically, breads and deli meats.

Though, I tend to do the opposite. I usually eat out for both lunch and dinner, but occasionally will cook dinner (such as pastas and some frozen meals). The reason I eat out for lunch is because I prefer social meals. Also, I can never remember to make my lunch the night before.

I wonder if frozen meals are healthier than eating out? They taste great and can be lighter on the wallet.

p.s. Eating out for me does not include any place that offers “super-sized” or “value menu” meals.

Teen questioned for online Bush threat.

I’m glad.  Isn’t it terrorists who want to undermine the US Government and destroy American citizens?

Code Search

October 5, 2006

I’m not sure how long this has been out, but I just found Google’s Code Search today. Anyways, I found this search to be particularly entertaining (and scary).

Cursor Icon Confusion

October 4, 2006

I just visited Lefsetz Letter, where I noticed that they use the cross hair cursor for text selection instead of the I-bar cursor. This seems more logical to me, especially since the I-bar represents editable text and cross represents selection. So how did the I-bar become the standard. So, check out that website and let me know what you think of the cross hairs.

Read this:

The Coming Dramatic Decline of Youtube

Then this:

Watch Full Length Cartoons Online (Massive List)

Then this:

Napster shut down

And more interestingly:

Mark Cuban/YouTube

Update: It looks like Mark Cuban was wrong. Google is a powerhouse.