~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/zeromq/docs/index.rst

  • Committer: Henrik Ingo
  • Date: 2011-08-29 12:24:27 UTC
  • mto: This revision was merged to the branch mainline in revision 2412.
  • Revision ID: henrik.ingo@avoinelama.fi-20110829122427-bj271mhsl4cq8nv2
Updated README
 - make sure links are up to date
 - add instructions to "apt-get build-dep drizzle" before first build from source

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
ZeroMQ
2
 
======
3
 
 
4
 
ZeroMQ is a messaging library that allows you to easily build complex
5
 
communication systems. The ZeroMQ plugin allows drizzle to publish
6
 
transactions to a local PUB socket. Many clients can subscribe to
7
 
these transactions. The first frame of the message sent out is the
8
 
schema name the transaction touched - this enables clients to only
9
 
subscribe to the interesting schemas (note that certain "transactions"
10
 
are without a schema, like SET xyz for example, for these, the first
11
 
frame is empty).
12
 
 
13
 
Getting started
14
 
---------------
15
 
 
16
 
First, install zeromq, get the code from `zeromq.org
17
 
<http://zeromq.org>`_, then you can build drizzle, watch the
18
 
./configure output to verify that drizzle finds the libraries needed.
19
 
 
20
 
Now you are good to go, simply start drizzle with --plugin-add=zeromq
21
 
and drizzle will start publishing transactions. The only configuration
22
 
parameter available is:
23
 
 
24
 
.. code-block:: bash
25
 
 
26
 
  --zeromq.endpoint arg (=tcp://*:9999) - the endpoint to expose.
27
 
 
28
 
Now you can write a simple python script to verify that it works,
29
 
something like this will work:
30
 
 
31
 
.. code-block:: python
32
 
 
33
 
  import zmq
34
 
 
35
 
  ctx = zmq.Context()
36
 
  s = ctx.socket(zmq.SUB)
37
 
  s.setsockopt(zmq.SUBSCRIBE, '')
38
 
  s.connect('tcp://localhost:9999')
39
 
  i = 0
40
 
  while True:
41
 
      i = i+1
42
 
      s.recv_multipart()
43
 
      print i
44
 
 
45
 
and then you can generate some load:
46
 
 
47
 
.. code-block:: bash
48
 
 
49
 
  bin/drizzleslap -c 10 -a --auto-generate-sql-add-autoincrement --burnin
50
 
 
51
 
which creates 10 threads and generates random queries.