Skip to main content

A Python library for NATS server connection, publishing, creation, and validation of events.

Project description

dverse-nats-helper

dverse-nats-helper is a Python library for dealing nats server connection, publishng, creation and validation of the events

Installation

Use the package manager pip to install dverse-nats-helper.

pip install dverse-nats-helper

Usage

import dverse-nats-helper

# Establishes a connection to the NATS server.
await connect_nats("nats://nats:4222")

# Constructs an event message conforming to a predefined schema.
# The object must implement a to_event_object() method.
system = { "platform": "example", "service": "example_svc", "event_type": "created"},
new_event = build_event(product,actor={"actor_id": str(seller.id), "username": seller.username}, system)

# Publishes an event to the specified NATS subject
# after validating the data against a predefined schema.
await publish_event("example.subject", new_event)

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

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

dverse_nats_helper-0.1.0.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

dverse_nats_helper-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file dverse_nats_helper-0.1.0.tar.gz.

File metadata

  • Download URL: dverse_nats_helper-0.1.0.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for dverse_nats_helper-0.1.0.tar.gz
Algorithm Hash digest
SHA256 80c3450829f28ce18940509bb8164ef6ab3ebc24b69607e26d0fdccfbaff24b1
MD5 6dba48efae2f802b5b2ff3bc86f7cc64
BLAKE2b-256 e25c42617ffe3492ceb04f44651949483a865feaaba91fbfd5ac461c46c96479

See more details on using hashes here.

File details

Details for the file dverse_nats_helper-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dverse_nats_helper-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 895539b69df649d8dd7fe1b198716937a5e1604b6257da9efc415bb9f4c1d35f
MD5 9483f1c4f4e35381c8bd6882bcc2b713
BLAKE2b-256 5f60c0b96162a3ff0ac16652aca428f975fdc96fe400c5c9c17c3fa687d0e959

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