[rabbitmq-discuss] Fwd: Problem with plugin development guide example

Jerry Kuch jerryk at vmware.com
Fri Mar 18 21:02:19 GMT 2011


Hi, Jim.

Attached is a gzipped tar file containing rabbitmq-empty-plugin, a close to absolutely bare bones plugin I made by stripping down one of my projects.

If you uncompress it under your checkout of rabbitmq-public-umbrella, you should be able to just go into that directory and type 'make'.

Then go over to your rabbitmq-server directory, which should be a sibling of the directory where the uncompressed empty plugin lives under your public-umbrella.  In the plugins subdirectory of rabbitmq-server create a symbolic link:

ln -s ../../rabbitmq-empty-plugin rabbitmq-empty-plugin

Now 'make run' to start up your broker.

If all goes well you'll see "rabbit_empty_plugin-0.1.0" appear in the "plugins activated" section of the broker's start-up preamble.

Once the Erlang REPL prompt appears again you can try:

appmon:start().

Explore the app tree that appears and you should see rabbit_empty_plugin present as a child of your rabbit process.  If you double click on the rabbit_empty_plugin node you'll see the supervision tree for the empty plugin.

Note that at the moment it really does nothing except start up.  The rabbit_empty_plugin is an instance of the Erlang 'application' behaviour, and it starts an OTP supervisor called 'rabbit_empty_sup' which lords over an Erlang process called 'rabbit_empty_worker', enforcing the restart policy indicated in the code with an iron, OTP-ish fist.

By grepping around for where the word "empty" appears in the .erl and .app files, and the Makefile, you should be able to mutate this into the basis of your very own Rabbit plugin.

Good luck.  Please let us know if we can help out further.

Best regards,
Jerry

P.S.  You mentioned that you were new to Erlang.  The Manning book below:

http://www.manning.com/logan/

is a good resource, and has better coverage of the OTP libraries and design principles than you'll find in many other places.  Armstrong's book is also likely to be helpful to you if you're going to be using Erlang much:

http://www.pragprog.com/titles/jaerlang/programming-erlang

________________________________________
From: jimirrer at gmail.com [jimirrer at gmail.com] On Behalf Of Jim Irrer [irrer at umich.edu]
Sent: Friday, March 18, 2011 12:50 PM
To: Jerry Kuch
Cc: rabbitmq-discuss at lists.rabbitmq.com
Subject: Re: [rabbitmq-discuss] Fwd: Problem with plugin development guide example

Jerry -

Yes, that would be great.  All I'm looking for is a hello world example of
a plugin to get me started.

Thanks,

- Jim

Jim Irrer     irrer at umich.edu<mailto:irrer at umich.edu>       (734) 647-4409
University of Michigan Hospital Radiation Oncology
519 W. William St.             Ann Arbor, MI 48103


On Fri, Mar 18, 2011 at 1:32 PM, Jerry Kuch <jerryk at vmware.com<mailto:jerryk at vmware.com>> wrote:
Jim:

I also have a vague recollection that a month or two ago I found a couple out of date spots in the plugin development guide that might cause you grief.  I did put together a basic plugin for other reasons, that I could conceivably husk out and share with you as a starting point you might find convenient?

Best regards,
Jerry
________________________________________
From: rabbitmq-discuss-bounces at lists.rabbitmq.com<mailto:rabbitmq-discuss-bounces at lists.rabbitmq.com> [rabbitmq-discuss-bounces at lists.rabbitmq.com<mailto:rabbitmq-discuss-bounces at lists.rabbitmq.com>] On Behalf Of Jim Irrer [irrer at umich.edu<mailto:irrer at umich.edu>]
Sent: Friday, March 18, 2011 9:22 AM
To: rabbitmq-discuss at lists.rabbitmq.com<mailto:rabbitmq-discuss at lists.rabbitmq.com>
Cc: Jim Irrer
Subject: Re: [rabbitmq-discuss] Fwd: Problem with plugin development guide      example

That was helpful - I got farther - but not there yet.

I did the checkout of the umbrella with the command above:

hg clone http://hg.rabbitmq.com/rabbitmq-public-umbrella -r bug23568

but I did the 'make co' without any special parameters, so I assumed
that it did hg commands with respect to the bug23568 branch.

I built the metronome project as outlined on the Rabbit site and added
the rabbit_metronome-0.0.0.ez and amqp_client.ez files to the
rabbitmq-public-umbrella/rabbitmq-server/plugins directory, but when I
start it up I get:

linus:make run
RABBITMQ_NODE_IP_ADDRESS="" RABBITMQ_NODE_PORT="5679" RABBITMQ_LOG_BASE="/tmp" RABBITMQ_MNESIA_DIR="/tmp/rabbitmq-bunny-mnesia" RABBITMQ_PLUGINS_EXPAND_DIR="/tmp/rabbitmq-bunny-plugins-scratch" \
               RABBITMQ_ALLOW_INPUT=true \
               RABBITMQ_SERVER_START_ARGS="" \
               ./scripts/rabbitmq-server
Activating RabbitMQ plugins ...
*WARNING* Undefined function amqp_connection:start_direct/0
*WARNING* Undefined function gb_trees:map/2
*WARNING* Undefined function os:timestamp/0
*WARNING* Undefined function random:seed/1
*WARNING* Undefined function ssl:ssl_accept/3
2 plugins activated:
* amqp_client-0.0.0
* rabbit_metronome-0.0.0

Erlang (BEAM) emulator version 5.6.5 [source] [64-bit] [smp:2] [async-threads:30] [hipe] [kernel-poll:true]


+---+   +---+
|   |   |   |
|   |   |   |
|   |   |   |
|   +---+   +-------+
|                   |
| RabbitMQ  +---+   |
|           |   |   |
| v%%VSN%%  +---+   |
|                   |
+-------------------+
AMQP 0-9-1 / 0-9 / 0-8
Copyright (C) 2007-2011 VMware, Inc.
Licensed under the MPL.  See http://www.rabbitmq.com/

node           : bunny at linus
app descriptor : /devel/home/irrer/tmp/erl/r2/rabbitmq-public-umbrella/rabbitmq-server/scripts/../ebin/rabbit.app
home dir       : /home/irrer
config file(s) : (none)
cookie hash    : JG6HnrDO2nMIVTU2s7iwoA==
log            : /tmp/bunny.log
sasl log       : /tmp/bunny-sasl.log
database dir   : /tmp/rabbitmq-bunny-mnesia
erlang version : 5.6.5

starting file handle cache server                                     ...done
starting worker pool                                                  ...done
starting database                                                     ...done
starting codec correctness check                                      ...done
-- external infrastructure ready
starting statistics event manager                                     ...done
starting logging server                                               ...done
starting plugin registry                                              ...done
starting auth mechanism amqplain                                      ...done
starting auth mechanism cr-demo                                       ...done
starting auth mechanism plain                                         ...done
starting exchange type direct                                         ...done
starting exchange type fanout                                         ...done
starting exchange type headers                                        ...done
starting exchange type topic                                          ...done
-- kernel ready
starting node monitor                                                 ...done
starting cluster delegate                                             ...done
starting guid generator                                               ...done
starting alarm handler                                                ...done
starting memory monitor                                               ...done
-- core initialized
starting empty DB check                                               ...done
starting exchange recovery                                            ...done
starting queue supervisor and queue recovery                          ...done
-- message delivery logic ready
starting error log relay                                              ...done
starting networking                                                   ...done
starting notify cluster nodes                                         ...done
starting direct_client                                                ...done

broker running
Eshell V5.6.5  (abort with ^G)
(bunny at linus)1> Erlang has closed
                                {"Kernel pid terminated",application_controller,"{application_start_failure,rabbit_metronome,{shutdown,{rabbit_metronome,start,[normal,[]]}}}"}

Crash dump was written to: erl_crash.dump
Kernel pid terminated (application_controller) ({application_start_failure,rabbit_metronome,{shutdown,{rabbit_metronome,start,[normal,[]]}}})

And as advertised it creates a big honkin' dump file.

I also had to create symbolic links so that the code would build.  In my
rabbitmq-public-umbrella/rabbit_metronome directory I created:

amqp_client -> ../rabbitmq-erlang-client/dist/amqp_client
rabbit_common -> ../rabbitmq-erlang-client/dist/rabbit_common

The server works fine if run without adding plugins, but when I add them
it bombs, so I know the plugins are the problem (Right?).

I'm new to Erlang (interesting language), so all I did was cut and paste
the example Erlang code, so if that code is out of date then it would be a problem.

Also: I changed the port to 5679 so it would not interfere with the official
installed RabbitMQ server on the same machine, and I set RABBITMQ_NODENAME
to 'bunny'.

Thanks,

- Jim

Jim Irrer     irrer at umich.edu<mailto:irrer at umich.edu><mailto:irrer at umich.edu<mailto:irrer at umich.edu>>       (734) 647-4409<tel:%28734%29%20647-4409><tel:%28734%29%20647-4409>
University of Michigan Hospital Radiation Oncology
519 W. William St.             Ann Arbor, MI 48103


On Thu, Mar 17, 2011 at 8:27 AM, Matthew Sackman <matthew at rabbitmq.com<mailto:matthew at rabbitmq.com><mailto:matthew at rabbitmq.com<mailto:matthew at rabbitmq.com>>> wrote:
On Tue, Mar 15, 2011 at 07:00:28PM -0400, Jim Irrer wrote:
> If I checkout the latest server code, will I get the bug23274 fix?

Nope. bug23274 has been abandoned. bug23568 replaces it, but is yet to
go through QA. None of the documentation regarding writing plugins has
been updated.

> If not, what is the Mercurial command to get it?

hg clone http://hg.rabbitmq.com/rabbitmq-public-umbrella -r bug23568

But you'll need to make sure all the plugins are also on branch bug23568
for them to work with the new build system.

If you're writing plugins from scratch, be sure to read the
rabbitmq-public-umbrella/README.makefiles file, which has a helpful
section on "Creating a new package".

Matthew
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com<mailto:rabbitmq-discuss at lists.rabbitmq.com><mailto:rabbitmq-discuss at lists.rabbitmq.com<mailto:rabbitmq-discuss at lists.rabbitmq.com>>
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss


-------------- next part --------------
A non-text attachment was scrubbed...
Name: rabbitmq-empty-plugin.tar.gz
Type: application/x-gzip
Size: 4353 bytes
Desc: rabbitmq-empty-plugin.tar.gz
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110318/1a3e76f9/attachment-0001.bin>


More information about the rabbitmq-discuss mailing list