Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions node.js/queue.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ Finally, entries in the dead letter queue can either be _revived_ by resetting t

### Additional APIs <Alpha />

#### Task Scheduling

You can use the `schedule` method as a shortcut for `cds.queued(srv).send()`, with optional scheduling options `after` and `every`:

```js
Expand All @@ -236,6 +238,7 @@ await srv.schedule('someEvent', { some: 'message' }).after('1h') // after one ho
await srv.schedule('someEvent', { some: 'message' }).every('1h') // every hour after each processing
```

#### Task Processing

To manually trigger the message processing, for example if your server is restarted, you can use the `flush` method.

Expand All @@ -244,6 +247,8 @@ const srv = await cds.connect.to('yourService')
cds.queued(srv).flush()
```

#### Task Callbacks

Once a message has been successfully processed, it triggers the `<event>/#succeeded` handlers.

```js
Expand Down