Skip to main content

amgi-nats

amgi-nats is an AMGI compatible server project, supporting running AMGI applications against NATS using either push or pull subscriptions.

Installation

pip install amgi-nats==0.47.0

Push Example

This example uses AsyncFast:

from dataclasses import dataclass

from amgi_nats.push import run
from asyncfast import AsyncFast

app = AsyncFast()


@dataclass
class Order:
    item_ids: list[str]


@app.channel("order.subject")
async def order_subject(order: Order) -> None:
    # Makes an order
    ...


if __name__ == "__main__":
    run(app, "order.subject")

Or the application could be run via the commandline:

asyncfast run amgi-nats-push main:app order.subject

Pull Example

The pull server is run the same way, but consumes from a JetStream pull consumer. The stream and consumer are created if they do not exist:

from dataclasses import dataclass

from amgi_nats.pull import run
from asyncfast import AsyncFast

app = AsyncFast()


@dataclass
class Order:
    item_ids: list[str]


@app.channel("order.subject")
async def order_subject(order: Order) -> None:
    # Makes an order
    ...


if __name__ == "__main__":
    run(app, "order.subject")

Or the application could be run via the commandline:

asyncfast run amgi-nats-pull main:app order.subject

Messages sent by the application are published through JetStream and wait for the stream acknowledgement, so a send that no stream accepts raises nats.js.errors.NoStreamResponseError. The nats reply binding is not supported for these sends, as the reply subject carries the acknowledgement. Push server sends use core NATS publishing, which is fire and forget.

Contact

For questions or suggestions, please contact jack.burridge@mail.com.

License

Copyright 2025 AMGI

Download files

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

Source Distribution

amgi_nats-0.47.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

amgi_nats-0.47.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file amgi_nats-0.47.0.tar.gz.

File metadata

  • Download URL: amgi_nats-0.47.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for amgi_nats-0.47.0.tar.gz
Algorithm Hash digest
SHA256 dce67947143949f15c4fd1321cee1f4f9607eaf5745633ab8f5fd8332ac091a4
MD5 9c276d0fe48950ff13c62e223a4d8d66
BLAKE2b-256 f9bebfabbd2c2c04c69b24575c35ac45ce97c67c3bbfa4c9c9a84c975f030ce2

See more details on using hashes here.

File details

Details for the file amgi_nats-0.47.0-py3-none-any.whl.

File metadata

  • Download URL: amgi_nats-0.47.0-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for amgi_nats-0.47.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cb7f055f1a02001ac795231863726fce9117a04ed8529ecabc27f7b8f95be800
MD5 e8c9d2a95e55862d5c18639634a02c6a
BLAKE2b-256 1466b97cca9776d94e9439bf1ed51c6c09a238ffcd401cc7f63d3aa0718ae9a5

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.47.0 This release

2 files

Supported by

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