Various wrapper classes I use in my projects
Go to file
2024-10-09 00:03:42 +03:00
.yarn/releases Add more debug statements to broker 2024-10-09 00:03:42 +03:00
scripts Optional prom-client peer dependency 2023-11-11 17:11:47 +02:00
src Add more debug statements to broker 2024-10-09 00:03:42 +03:00
tests Add more debug statements to broker 2024-10-09 00:03:42 +03:00
.eslintignore Add more debug statements to broker 2024-10-09 00:03:42 +03:00
.eslintrc.json Add more debug statements to broker 2024-10-09 00:03:42 +03:00
.gitignore
.yarnrc.yml Add more debug statements to broker 2024-10-09 00:03:42 +03:00
index.ts
LICENSE
package.json Add more debug statements to broker 2024-10-09 00:03:42 +03:00
README.md
tsconfig.cjs.json Fix interface types 2023-11-29 13:44:34 +02:00
tsconfig.json Fix interface types 2023-11-29 13:44:34 +02:00
yarn.lock Upgrade yarn 2024-03-29 09:22:02 +02:00

wrappers

Various wrapper classes I use in my projects.
These are specifically written for my use cases, though feel free to use.

MessageBroker: Wraps amqp-connection-manager and amqplib by extension. Ensures smooth failover when connected to a cluster.
MariaDB: Wraps mysql. Takes care of connection pooling whether connecting to a cluster or single instance.
MongoDB: Wraps mongodb. Primarily just adds helper functions.

The MariaDB wrapper takes care of automatic cluster status updates if supplied with an event source, it provides a listener through the statusUpdateListener property. It ensures that the wrapper does not query a node that is not currently synced in the cluster. Somewhat similar to how the MessageBroker handles automatic failover.
The MongoDB native driver seems to take care of this stuff by itself, so it remains a fairly trivial wrapper with just helper functions.

A notification script that can be used to listen for cluster updates is located in /scripts/wsrep_notify.sh. It takes the arguments provided by galera and posts them to a given URL, the JSON payload is then to be fed into the status update listener of the MariaDB wrapper.

Expected to be used together with a parent class that has a createLogger method, as defined in /src/interfaces/Server.ts and /src/interfaces/Logger.ts, utilising the logger from https://git.corgi.wtf/Navy.gif/logger.