mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Fix typos
This commit is contained in:
parent
0f139a1999
commit
229a476aa0
@ -2,7 +2,7 @@ The Event Plugin API [experimental]
|
|||||||
===================================
|
===================================
|
||||||
|
|
||||||
.. danger::
|
.. danger::
|
||||||
The Event Plugin API is **experimental** and might change in the future.
|
The Event Plugin API is **experimental** and might change in the future.
|
||||||
|
|
||||||
BigchainDB implements an internal event system that allows different software
|
BigchainDB implements an internal event system that allows different software
|
||||||
components to receive updates on specific topics. The WebSocket API, for example,
|
components to receive updates on specific topics. The WebSocket API, for example,
|
||||||
@ -11,10 +11,10 @@ voted valid, the WebSocket API is notified, and it sends updates to all the
|
|||||||
clients connected.
|
clients connected.
|
||||||
|
|
||||||
We decided to make this internal event system public, to allow developers to
|
We decided to make this internal event system public, to allow developers to
|
||||||
integrate BigchainDB with other applications, such as AMPQ systems.
|
integrate BigchainDB with other applications, such as AMQP systems.
|
||||||
|
|
||||||
|
|
||||||
Available events
|
Available Events
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
The event types are listed in the source file ``bigchaindb/events.py``.
|
The event types are listed in the source file ``bigchaindb/events.py``.
|
||||||
@ -34,14 +34,12 @@ The event types are listed in the source file ``bigchaindb/events.py``.
|
|||||||
- a block has been voted invalid by the network.
|
- a block has been voted invalid by the network.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Plugin Example
|
Plugin Example
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
We developed a minimal plugin that listens to new valid blocks and prints them
|
We developed a minimal plugin that listens to new valid blocks and prints them
|
||||||
to the console:
|
to the console:
|
||||||
|
https://github.com/bigchaindb/bigchaindb_events_plugin_example
|
||||||
- https://github.com/bigchaindb/bigchaindb_events_plugin_example
|
|
||||||
|
|
||||||
|
|
||||||
Architecture of an Event Plugin
|
Architecture of an Event Plugin
|
||||||
@ -52,16 +50,18 @@ Creating your own plugin is really easy, and can be summarized in few steps:
|
|||||||
1. Create a new Python package that defines the entry point ``bigchaindb.events`` in its ``setup.py``.
|
1. Create a new Python package that defines the entry point ``bigchaindb.events`` in its ``setup.py``.
|
||||||
2. In your entry point, define two properties:
|
2. In your entry point, define two properties:
|
||||||
|
|
||||||
- ``event_types``: a variable to tell BigchainDB to which events your plugin is interested.
|
- ``event_types``: a variable to tell BigchainDB which events your plugin is interested in.
|
||||||
|
A plugin can subscribe to more than one events by combining them using the
|
||||||
|
**binary or** operator, e.g. in case you want to subscribe to both valid and
|
||||||
|
invalid blocks your ``event_types`` can be ``1 | 2``.
|
||||||
- ``run``: a function that will process the events coming from BigchainDB.
|
- ``run``: a function that will process the events coming from BigchainDB.
|
||||||
3. Install the newly created Python in the current environment.
|
3. Install the newly created Python package in the current environment.
|
||||||
4. Add the plugin name to your BigchainDB configuration.
|
4. Add the plugin name to your BigchainDB configuration.
|
||||||
5. (Re)start BigchainDB
|
5. (Re)start BigchainDB.
|
||||||
|
|
||||||
If the installation was successful, the plugin will be run in a different
|
If the installation was successful, the plugin will be run in a different
|
||||||
process. Your plugin will receive events through a ``multiprocessing.Queue``
|
process. Your plugin will receive events through a ``multiprocessing.Queue``
|
||||||
object. Remember: it's your plugin responsibility to consume that queue.
|
object.
|
||||||
|
|
||||||
A plugin can subscribe to more than one events by combining them using the
|
.. note::
|
||||||
**binary or** operator, e.g. in case you want to subscribe to both valid and
|
It's your plugin's responsibility to consume it's queue.
|
||||||
invalid blocks your ``event_types`` can be ``1 | 2``.
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user