pgnats

0

Описание

PostgreSQL extension for NATS messaging

Языки

  • Rust89,3%
  • PLpgSQL9,2%
  • Makefile1,5%
10 месяцев назад
3 месяца назад
10 месяцев назад
4 месяца назад
месяц назад
3 месяца назад
3 месяца назад
10 месяцев назад
7 месяцев назад
3 месяца назад
10 месяцев назад
README.md

📡 pgnats - PostgreSQL extension for NATS messaging

Provides seamless integration between PostgreSQL and NATS messaging system, enabling:

  • Message publishing to core NATS subjects from SQL
  • Subscriptions to NATS subjects that invoke PostgreSQL functions on incoming messages
  • JetStream persistent message streams
  • Key-Value storage operations from SQL
  • Object Store operations (uploading, downloading, deleting files) from SQL
  • Works on Postgres Cluster

⚙️ Install

See INSTALL.md for instructions on how to install required system dependencies.

🛠️ PostgreSQL Configure options

You can fine tune PostgreSQL build options:

cargo pgrx init --configure-flag='--without-icu'

📦 Build package

🔧 Selecting Features

By default, all features (

kv
,
object_store
,
sub
) are enabled. If you prefer a smaller build or want to customize the functionality, you can selectively enable features like so:

This will include only the

kv
feature and exclude
object_store
and
sub
.

For example:

  • --features "kv"
    – enables only the NATS key-value store.
  • --features "sub"
    – enables subscriptions and HTTP integration with Patroni.
  • --features "object_store"
    – enables binary object storage support.

You can combine them as needed:

🧪 Tests

Warning

Before starting the test, NATS-Server should be started on a local host with port 4222.

Warning

You need docker installed for integration testing.

Run all tests

🦀 Minimum supported Rust version

  • Rust 1.82.0

📚 Documentation

To view the documentation, run:

The exported PostgreSQL API is implemented in the

api
module.

📘 Usage

⚙️ Configuration

To configure the NATS connection, you need to create a Foreign Server:

Notification body

🔄 Reload configuration

📤 Publish

🧊 Binary

📝 Utf-8 Text

📄 JSON

🧱 Binary JSON

📡 Subscribe to Subjects

Warning

The specified PostgreSQL function must accept a single argument of type

bytea
, which contains the message payload from NATS.

Subscription Architecture

Subscription Architecture

📥 Request

🗃️ Key-Value Storage

🗂️ Object Storage

🛠️ Utils