docs/_static/moksha-hub.png |binary docs/main/DataStreams.rst | 39 --------------------------------------- docs/main/MokshaHub.rst | 9 +++++---- docs/main/Producers.rst | 43 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 43 deletions(-)
New commits: commit f8fd9d896f19bcfd3532aaacf6cf295314ae6d5f Author: Luke Macken lmacken@redhat.com Date: Wed Dec 16 21:29:56 2009 -0500
More improvements to the hub docs
diff --git a/docs/main/MokshaHub.rst b/docs/main/MokshaHub.rst index 8f14056..1886cb3 100644 --- a/docs/main/MokshaHub.rst +++ b/docs/main/MokshaHub.rst @@ -27,11 +27,11 @@ CentralMokshaHub
The :class:`CentralMokshaHub` is the primary consumer of all message `topics`. It runs outside of the Moksha WSGI application stack, and is automatically -started by the `start-moksha` script. +started by the `start-moksha` script (and can be started manually by running `moksha-hub`.
The :class:`CentralMokshaHub` currently handles the following tasks:
-* Feeds `Consumers` new messages for specific topics +* Feeds :doc:`Consumers` new messages for specific topics * Runs all of the :doc:`Producers`
.. image:: ../_static/moksha-hub.png
commit c90c2198874a9b91e7efebd1b540e27df0e7ed49 Author: Luke Macken lmacken@redhat.com Date: Wed Dec 16 21:24:16 2009 -0500
Rename our DataStream docs to Producer docs
diff --git a/docs/main/Producers.rst b/docs/main/Producers.rst index f0a24fa..e02bbdc 100644 --- a/docs/main/Producers.rst +++ b/docs/main/Producers.rst @@ -1,27 +1,31 @@ -============ -Data Streams -============ +========= +Producers +=========
-Moksha offers a :class:`DataStream` API that allows you to easily provide -data to your message brokers. DataStreams are loaded and run by the :class:`MokshaHub`, isolated from the WSGI application. +Moksha offers a :class:`Producer` API that allows you to easily provide data to +your message brokers. Producers are loaded and run by the :class:`MokshaHub`, +isolated from the WSGI application.
-The DataStreams contain a connection to the MokshaHub via the `self.hub` -object. It also provides a `send_message(topic, message)` method that will -send your message to the hub. +The Producers contain a connection to the MokshaHub via the `self.hub` object. +It also provides a `send_message(topic, message)` method that will send your +message to the hub.
Polling Data Streams --------------------
-The :class:`PollingDataStream` will automatically wake up at a given `frequency` (which can be a `datetime.timedelta` object, or the number of a seconds), and call the :meth:`poll` method. +The :class:`PollingProducer` will automatically wake up at a given `frequency` +(which can be a `datetime.timedelta` object, or the number of a seconds), and +call the :meth:`poll` method.
-Below is an example of a :class:`PollingDataStream` that wakes up every 10 seconds, and sends a 'Hello World!' message to the 'hello' `topic`. +Below is an example of a :class:`PollingProducer` that wakes up every 10 +seconds, and sends a 'Hello World!' message to the 'hello' `topic`.
.. code-block:: python
from datetime import timedelta - from moksha.api.streams import PollingDataStream + from moksha.api.hub.producer import PollingProducer
- class HelloWorldDataStream(PollingDataStream): + class HelloWorldProducer(PollingProducer): frequency = timedelta(seconds=10)
def poll(self): @@ -30,10 +34,10 @@ Below is an example of a :class:`PollingDataStream` that wakes up every 10 secon Installing ----------
-To install your `DataStream`, simply add it to the `[moksha.stream]` entry-point +To install your `Producer`, simply add it to the `[moksha.stream]` entry-point in your `setup.py`, like so:
.. code-block:: python
- [moksha.stream] - hello = myproject.streams.hello:HelloWorldDataStream + [moksha.producer] + hello = myproject.streams.hello:HelloWorldProducer
commit d06e1fb3a27617f752fad8cc7445ad4dfa0ab034 Author: Luke Macken lmacken@redhat.com Date: Wed Dec 16 21:23:40 2009 -0500
Update our MokshaHub docs, and add a diagram
diff --git a/docs/_static/moksha-hub.png b/docs/_static/moksha-hub.png new file mode 100644 index 0000000..a98299f Binary files /dev/null and b/docs/_static/moksha-hub.png differ diff --git a/docs/main/DataStreams.rst b/docs/main/DataStreams.rst deleted file mode 100644 index f0a24fa..0000000 --- a/docs/main/DataStreams.rst +++ /dev/null @@ -1,39 +0,0 @@ -============ -Data Streams -============ - -Moksha offers a :class:`DataStream` API that allows you to easily provide -data to your message brokers. DataStreams are loaded and run by the :class:`MokshaHub`, isolated from the WSGI application. - -The DataStreams contain a connection to the MokshaHub via the `self.hub` -object. It also provides a `send_message(topic, message)` method that will -send your message to the hub. - -Polling Data Streams --------------------- - -The :class:`PollingDataStream` will automatically wake up at a given `frequency` (which can be a `datetime.timedelta` object, or the number of a seconds), and call the :meth:`poll` method. - -Below is an example of a :class:`PollingDataStream` that wakes up every 10 seconds, and sends a 'Hello World!' message to the 'hello' `topic`. - -.. code-block:: python - - from datetime import timedelta - from moksha.api.streams import PollingDataStream - - class HelloWorldDataStream(PollingDataStream): - frequency = timedelta(seconds=10) - - def poll(self): - self.send_message('hello', 'Hello World!') - -Installing ----------- - -To install your `DataStream`, simply add it to the `[moksha.stream]` entry-point -in your `setup.py`, like so: - -.. code-block:: python - - [moksha.stream] - hello = myproject.streams.hello:HelloWorldDataStream diff --git a/docs/main/MokshaHub.rst b/docs/main/MokshaHub.rst index e9f2a0c..8f14056 100644 --- a/docs/main/MokshaHub.rst +++ b/docs/main/MokshaHub.rst @@ -31,6 +31,7 @@ started by the `start-moksha` script.
The :class:`CentralMokshaHub` currently handles the following tasks:
-* Consumes all messages from STOMP and AMQP brokers * Feeds `Consumers` new messages for specific topics -* Runs all of the `DataStreams` +* Runs all of the :doc:`Producers` + +.. image:: ../_static/moksha-hub.png diff --git a/docs/main/Producers.rst b/docs/main/Producers.rst new file mode 100644 index 0000000..f0a24fa --- /dev/null +++ b/docs/main/Producers.rst @@ -0,0 +1,39 @@ +============ +Data Streams +============ + +Moksha offers a :class:`DataStream` API that allows you to easily provide +data to your message brokers. DataStreams are loaded and run by the :class:`MokshaHub`, isolated from the WSGI application. + +The DataStreams contain a connection to the MokshaHub via the `self.hub` +object. It also provides a `send_message(topic, message)` method that will +send your message to the hub. + +Polling Data Streams +-------------------- + +The :class:`PollingDataStream` will automatically wake up at a given `frequency` (which can be a `datetime.timedelta` object, or the number of a seconds), and call the :meth:`poll` method. + +Below is an example of a :class:`PollingDataStream` that wakes up every 10 seconds, and sends a 'Hello World!' message to the 'hello' `topic`. + +.. code-block:: python + + from datetime import timedelta + from moksha.api.streams import PollingDataStream + + class HelloWorldDataStream(PollingDataStream): + frequency = timedelta(seconds=10) + + def poll(self): + self.send_message('hello', 'Hello World!') + +Installing +---------- + +To install your `DataStream`, simply add it to the `[moksha.stream]` entry-point +in your `setup.py`, like so: + +.. code-block:: python + + [moksha.stream] + hello = myproject.streams.hello:HelloWorldDataStream
moksha-commits@lists.fedorahosted.org