lonnymq 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -176,6 +176,10 @@ Using PostgreSQL `NOTIFY`, we can receive a granular stream of queue events:
176
176
 
177
177
  To enable this feature, ensure the optional `eventChannel` is defined when constructing the SQL migrations.
178
178
 
179
+ ```typescript
180
+ const migrations = queue.migrations({ eventChannel: "EVENTS"})
181
+ ```
182
+
179
183
  ### Improving on Polling
180
184
 
181
185
  The simplest approach for processing messages is to call `dequeue` in a loop, backing off with a sleep when no messages are available. The downside of this approach is that we lose reactivity as we increase the polling timeout interval.
@@ -185,9 +189,6 @@ To improve reactivity, you can use the `retryMs` returned when failing to dequeu
185
189
  Unfortunately, this doesn't help in situations where a message is created or deferred while a worker is sleeping. However, by tracking the `delayMs` provided by the `MESSAGE_CREATED` and `MESSAGE_DEFERRED` events, we can determine the minimum amount of time to sleep until a message becomes available.
186
190
 
187
191
  ```typescript
188
- const queue = new Queue({ schema: "lonny" })
189
- const migrations = queue.migrations({ eventChannel: "EVENTS" })
190
-
191
192
  // LISTEN/NOTIFY only works with a single connection - not on a connection pool.
192
193
  const client = await databaseClient.connect()
193
194
  await client.query(`LISTEN "EVENTS"`)
@@ -208,7 +209,6 @@ client.on("notification", (msg) => {
208
209
  The `MESSAGE_DELETED` event can be used to create coordination patterns where one part of your application waits for an unrelated job to complete. By listening for deletion events on specific channels or message names, you can implement blocking operations that wait for background work to finish.
209
210
 
210
211
  ```typescript
211
- // Worker process
212
212
  const client = await databaseClient.connect()
213
213
  await client.query(`LISTEN "EVENTS"`)
214
214