https://github.com/rtasalem/busgres
Busgres is a Node.js package that will receieve a message from an Azure Service Bus queue or topic and save it into a PostgreSQL database.
https://github.com/rtasalem/busgres
azure npm postgresql service-bus
Last synced: about 1 month ago
JSON representation
Busgres is a Node.js package that will receieve a message from an Azure Service Bus queue or topic and save it into a PostgreSQL database.
- Host: GitHub
- URL: https://github.com/rtasalem/busgres
- Owner: rtasalem
- License: mit
- Created: 2024-04-16T20:49:51.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-28T00:07:55.000Z (3 months ago)
- Last Synced: 2025-08-09T02:48:58.763Z (2 months ago)
- Topics: azure, npm, postgresql, service-bus
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/busgres
- Size: 222 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Busgres
Service BUS + PostGRES = Busgres[Busgres](https://www.npmjs.com/package/busgres) is a Node.js package that will receive a message from an Azure Service Bus queue or topic and save it into a PostgreSQL database. It abstracts the [`@azure/service-bus`](https://www.npmjs.com/package/@azure/service-bus) and [`pg` (node-postgres)](https://www.npmjs.com/package/pg) packages for Service Bus and Postgres integration.
## Note
For the best experience, use only Busgres `v5.0.3` and above.
## Installation
This package can be installed using NPM:
```
npm i busgres
```## Usage
`BusgresClient` set-up & configuration:
```javascript
import { BusgresClient } from 'busgres'
import 'dotenv/config'const busgresClient = new BusgresClient({
serviceBus: {
connectionString: process.env.SB_CONNECTION_STRING,
entity: process.env.SB_ENTITY,
entityType: 'queue'
},
postgres: {
username: process.env.PG_USERNAME,
password: process.env.PG_PASSWORD,
database: process.env.PG_DATABASE,
host: process.env.PG_HOST,
port: process.env.PG_PORT
}
})const tableName = 'busgres'
const columnNames = ['message']export {
busgresClient,
tableName,
columnNames
}
```NOTE: If using topics, provide the topic name for `sbEntityName` in place of a queue name. Additionally, ensure `sbEntityType` is set to `'topic'` and that a value for `sbEntitySubscription` is also provided.
Starting the `BusgresClient` connection:
```javascript
import {
busgresClient,
tableNames,
columnNames
} from './busgres-config.js'await busgresClient.start(tableName, columnNames)
process.on('SIGINT', async () => {
await busgresClient.stop()
process.exit()
})```
With the above set-up and configuration a basic working `BusgresClient` connection can be established.## Demo
A simple demo Node.js application, [busgres-demo](https://github.com/rtasalem/busgres-demo), was created to test the functionality of this package during its development and to provide further example of usage.
## License
This package is licensed under the [MIT License](./LICENSE).
## Feedback
Feel free to reach out if you have any suggestions for improvement or further development.
## Dependencies
This package has a total of 2 dependencies on the following:
- [@azure/service-bus](https://www.npmjs.com/package/@azure/service-bus)
- [pg](https://www.npmjs.com/package/pg)## Author
[Rana Salem](https://github.com/rtasalem)