~drizzle-trunk/drizzle/development

2397.1.3 by Daniel Nichter
Complete documenting 2nd half of plugins.
1
ZeroMQ
2
======
3
2386.1.2 by Marcus Eriksson
add schema as first frame and add some initial docs
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
---------------
2397.1.3 by Daniel Nichter
Complete documenting 2nd half of plugins.
15
2386.1.2 by Marcus Eriksson
add schema as first frame and add some initial docs
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.