Skip to content
Newer
Older
100644 80 lines (58 sloc) 2.77 KB
be4be38 @jbrisbin Initial commit
authored Apr 15, 2011
1 # Riak RabbitMQ postcommit hook
2
3 This is a postcommit hook that sends entries into a RabbitMQ broker using the
4 Erlang AMQP client.
5
6 You set this module/function as your postcommit hook using whatever tools you're
7 used to. Your bucket properties should look something like this:
8
9 {
10 "props":{
11 "postcommit":[{"mod":"riak_rabbitmq","fun":"postcommit_send_amqp"}],
12 ... other props ...
13 }
14 }
15
16 ### Installation
17
8177215 @jbrisbin Updated README
authored Oct 17, 2011
18 To install from the binary (compiled with Erlang R14B03), download the tar.gz file.
232df25 @jbrisbin Updated README to document binary install.
authored Apr 16, 2011
19 cd into the Riak `lib` directory. For example, Homebrew users on a Mac would:
0d3e3ab @jbrisbin Tweaked README, cleaned formatting
authored Apr 15, 2011
20
8177215 @jbrisbin Updated README
authored Oct 17, 2011
21 cd /usr/local/Cellar/riak/1.0.0/libexec/lib
22 tar -zxvf $HOME/Downloads/riak_rabbitmq-0.1.4-R14B03.tar.gz
232df25 @jbrisbin Updated README to document binary install.
authored Apr 16, 2011
23
8177215 @jbrisbin Updated README
authored Oct 17, 2011
24 This should give you three new directories alongside `riak_kv-1.0.0` and the other
232df25 @jbrisbin Updated README to document binary install.
authored Apr 16, 2011
25 libraries:
26
8177215 @jbrisbin Updated README
authored Oct 17, 2011
27 amqp_client-2.6.1
28 rabbit_common-2.6.1
29 riak_rabbitmq-0.1.4
232df25 @jbrisbin Updated README to document binary install.
authored Apr 16, 2011
30
31 You can also clone the source, build, and then symlink the required dependencies
32 into your Riak install:
be4be38 @jbrisbin Initial commit
authored Apr 15, 2011
33
34 git clone git://github.com/jbrisbin/riak-rabbitmq-commit-hooks.git
35 cd riak-rabbitmq-commit-hooks
36 ./rebar get-deps
37 make
38 [...wait for a long time while spidermonkey builds...]
39 cd $RIAK_LIBS
8177215 @jbrisbin Updated README
authored Oct 17, 2011
40 ln -s $BUILD_DIR riak_rabbitmq-0.1.4
41 ln -s $BUILD_DIR/deps/amqp_client amqp_client-2.6.1
42 ln -s $BUILD_DIR/deps/rabbit_common rabbit_common-2.6.1
be4be38 @jbrisbin Initial commit
authored Apr 15, 2011
43
232df25 @jbrisbin Updated README to document binary install.
authored Apr 16, 2011
44 Either of these install methods should expose the module and the right dependencies
45 to your Riak server.
be4be38 @jbrisbin Initial commit
authored Apr 15, 2011
46
47 ### Configuration
48
49 To tell the commit hook where to send your entry in the form of an AMQP message,
50 you can pass special metadata properties to influence the commit hook's behaviour.
51 The list of acceptable properties is pretty self-explanatory:
52
512da89 @jbrisbin Tweaked README to document ignore flag and per-bucket metadata config…
authored Apr 20, 2011
53 * `X-Riak-Meta-Amqp-Exchange`
54 * `X-Riak-Meta-Amqp-Routing-Key`
55 * `X-Riak-Meta-Amqp-Host`
56 * `X-Riak-Meta-Amqp-Port`
57 * `X-Riak-Meta-Amqp-Vhost`
58 * `X-Riak-Meta-Amqp-User`
59 * `X-Riak-Meta-Amqp-Password`
60
61 Alternatively, you can specify settings for an entire bucket by setting these metadata headers
62 on an empty document at the key `AMQP-Meta` in the bucket you want to configure.
63
64 This allows you to route entries in an entire bucket to specific RabbitMQ servers without
65 your publisher having to know this information ahead of time.
66
67 ### Ignore Flag
68
69 If you don't want a particular entry in a RabbitMQ-enabled bucket to actually be sent out
70 (like if you're updating the `AMQP-Meta` entry), then set a metadata header with the name
71 `X-Riak-Meta-Amqp-Ignore` to the string "true". The postcommit hook will see this flag and
72 not actually send any message.
73
74 ### Deleted Entries
75
76 If the update operation is a DELETE, the postcommit hook will set an AMQP message header named
77 `X-Riak-Deleted` to "true". This way your application can distinguish between updates and deletes.
78
79 This utility is Apache licensed, just like Riak.
Something went wrong with that request. Please try again.