Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Menu
Open sidebar
dalibo
dramatiq-pg
Commits
d75d42b0
Verified
Commit
d75d42b0
authored
Oct 01, 2019
by
Étienne BERSAC
Browse files
Document API
parent
b39ccea9
Changes
2
Hide whitespace changes
Inline
Side-by-side
docs/api.rst
0 → 100644
View file @
d75d42b0
===============
API Reference
===============
Dramatiq-pg ships a relatively simple API. Once you have initiated the broker,
you're almost done with Dramatiq-pg and can use Dramatiq as usual.
``dramatiq_pg.PostgresBroker(url="", pool=None, results=True)``
===============================================================
:pool:
A psycopg2 pool object. Should be ThreadedConnectionPool for thread safety.
:url:
A PostgreSQL connection string as understood by libpq. Dramatiq-pg extends
libpq URL-style connection string with ``minconn`` and ``maxconn``
parameters. Defaults to empty string, leading libpq to read values from
environment variables.
:results:
a boolean indicating whether to initialize a result backend. Default is True.
Defining both pool and url raises a ValueError.
**Attributes**
:backend:
The PostgresBackend sharing the connection pool of the broker. Required to
fetch result.
**Example**
Initialization:
.. code:: python
from dramatiq_pg import PostgresBroker
broker = PostgresBroker("postgresql://user:pass@host/dbname?maxconn=12")
set_broker(broker)
Result usage:
.. code:: python
message.get_result(backend=broker.backend)
``dramatiq_pg.PostgresBackend(url="", pool=None)``
==================================================
Postgres-backed implementation of result storage for Dramatiq.
pool and url arguments have the same meaning and the same behaviour as for
PostgresBroker.
docs/index.rst
View file @
d75d42b0
...
...
@@ -25,6 +25,7 @@ Contents
- `Get Started <get-started.rst>`_
- `User Guide <user-guide.rst>`_
- `Deployment Guide <deployment-guide.rst>`_
- `API Reference <api.rst>`_
- `Why Postgres ? <why.rst>`_
- `Changelog <./changelog.rst>`_
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment