Creates the pool that Hermes polls the outbox with.
Every connection of the pool runs in READ COMMITTED, so the statements of Hermes lock only the rows they change,
not the gaps between them, which would stop the application from inserting new messages. resetOnRelease is
turned off, because resetting a connection would bring back the default isolation level. When the isolation level
of a new connection cannot be set, the connection is closed, the statement waiting for it fails, and the polling
outbox tries again at the next poll.
Keep it apart from the pool of the application, so the isolation level of the application does not change. Hermes
needs only a few connections, so the pool has at most connectionLimit of them, and the statements wait in a queue
for a free connection (waitForConnections and queueLimit of options are ignored). The statements are short, so
a few connections serve many partitions published at the same time. A statement waits for a lock of a row
(innodb_lock_wait_timeout) or of a table (lock_wait_timeout, e.g. behind ALTER TABLE) at most 5 seconds, so
it does not hold a connection, and the renewals of the claims queued behind it, for longer.
Parameters
options: PoolOptions
The options of the mysql2 pool
connectionLimit: number = DefaultPollingConnectionLimit
Creates the pool that Hermes polls the outbox with.
Every connection of the pool runs in
READ COMMITTED, so the statements of Hermes lock only the rows they change, not the gaps between them, which would stop the application from inserting new messages.resetOnReleaseis turned off, because resetting a connection would bring back the default isolation level. When the isolation level of a new connection cannot be set, the connection is closed, the statement waiting for it fails, and the polling outbox tries again at the next poll.Keep it apart from the pool of the application, so the isolation level of the application does not change. Hermes needs only a few connections, so the pool has at most
connectionLimitof them, and the statements wait in a queue for a free connection (waitForConnectionsandqueueLimitofoptionsare ignored). The statements are short, so a few connections serve many partitions published at the same time. A statement waits for a lock of a row (innodb_lock_wait_timeout) or of a table (lock_wait_timeout, e.g. behindALTER TABLE) at most 5 seconds, so it does not hold a connection, and the renewals of the claims queued behind it, for longer.