Skip to main content

data transportation from NSQ to ArangoDB

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nsq2arangodb-1.0.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nsq2arangodb-1.0.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file nsq2arangodb-1.0.1.tar.gz.

File metadata

  • Download URL: nsq2arangodb-1.0.1.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for nsq2arangodb-1.0.1.tar.gz
Algorithm Hash digest
SHA256 17ba5649d73c3082a047da8b2bc395bf891003c59de2d954721b9facba7af8ed
MD5 d5e4f663445e155f31770836f1de64fe
BLAKE2b-256 919a0930dfd06170c6f806a0eb42afdc7bf31818ca1607f5314ce17416a92100

See more details on using hashes here.

File details

Details for the file nsq2arangodb-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: nsq2arangodb-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for nsq2arangodb-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 58ca8830e7b28527b02d420e97c9c6307e1735e76a3de6e5ae3e5fdacd48cfa7
MD5 efec25221739466c48a44ea532ad9329
BLAKE2b-256 72743ec0b17d178000ca2deb31c0071aa1a01d63d1870b3775891da7802312ac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page