nsq2arangodb
NSQ is a realtime distributed messaging platform and ArangoDB is a multi-model database. While NSQ is data agnostic, it is for sure possible to transport JSON. This package implements insertion of NSQ message bodies into an ArangoDB.
Installation
pip install nsq2arangodb
Usage
Successfully tested with pyArango==2.0.1 and pynsq==0.9.1.
$ python nsq2arangodb/nsq2arangodb.py --help
usage: nsq2arangodb.py [-h] [--debug] [--arangodb-url ARANGODB_URL]
[--arangodb-database ARANGODB_DATABASE]
[--arangodb-username ARANGODB_USERNAME]
[--arangodb-password ARANGODB_PASSWORD]
[--nsq-address NSQ_ADDRESS] [--nsq-port NSQ_PORT]
[--nsq-channel-name NSQ_CHANNEL_NAME]
NSQ_TOPIC ARANGODB_COLLECTION
positional arguments:
NSQ_TOPIC
ARANGODB_COLLECTION
optional arguments:
-h, --help show this help message and exit
--debug
--arangodb-url ARANGODB_URL
--arangodb-database ARANGODB_DATABASE
--arangodb-username ARANGODB_USERNAME
--arangodb-password ARANGODB_PASSWORD
--nsq-address NSQ_ADDRESS
--nsq-port NSQ_PORT
--nsq-channel-name NSQ_CHANNEL_NAME
Most command line switches can also be set via corresponding environment variables.
Command Line Examples
alias n2a="./path/to/nsq2arangodb.py"
export ARANGODB_URL="https://avocado.example.com/"
export ARANGODB_USERNAME="your-username"
export ARANGODB_PASSWORD="your-password"
export ARANGODB_DATABASE="your-database"
n2a nsq-topic arangodb-collection
n2a --channel custom-channel-name other-topic other-collection
Code Examples
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
import nsq2arangodb as n2a
n2a.Nsq2ArangoDB(
logging.getLogger(),
n2a.ArangoDBConfig(
url='https://avocado.example.com/',
username='your-username',
password='your-password',
database='your-database',
collection='your-collection',
),
n2a.NsqConfig(
address='127.0.0.1',
port=4150,
topic='your-topic',
channel='nsq2arangodb'
)
)
Limitations
- No concurrency (but in-flight support)
- JSON decoding errors are just logged as exceptions and not re-queued, potential solution here is to push them to another configurable queue
Development
pip install -r requirements.txt
Metadata
Release files for nsq2arangodb 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nsq2arangodb-1.0.1.tar.gz | 4.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nsq2arangodb-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.7 kB
Release files / nsq2arangodb-1.0.1.tar.gz
| Download URL | nsq2arangodb-1.0.1.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
17ba5649d73c3082a047da8b2bc395bf891003c59de2d954721b9facba7af8ed
|
|
BLAKE2b-256 checksum How to use checksums |
919a0930dfd06170c6f806a0eb42afdc7bf31818ca1607f5314ce17416a92100
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.1
|
Release files / nsq2arangodb-1.0.1-py3-none-any.whl
| Download URL | nsq2arangodb-1.0.1-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
58ca8830e7b28527b02d420e97c9c6307e1735e76a3de6e5ae3e5fdacd48cfa7
|
|
BLAKE2b-256 checksum How to use checksums |
72743ec0b17d178000ca2deb31c0071aa1a01d63d1870b3775891da7802312ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.1
|