pgnats
Языки
- Rust89,3%
- PLpgSQL9,2%
- Makefile1,5%
📡 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 (, , ) 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 feature and exclude and .
For example:
– enables only the NATS key-value store.--features "kv"– enables subscriptions and HTTP integration with Patroni.--features "sub"– enables binary object storage support.--features "object_store"
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 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
, which contains the message payload from NATS.bytea