wrappers/README.md

15 lines
1.4 KiB
Markdown
Raw Permalink Normal View History

# 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.
2023-04-12 13:23:41 +02:00
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.