Skip to content

Commit 45c68b5

Browse files
author
magne
committed
chore: update examples accordingly
1 parent d4478da commit 45c68b5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

examples/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,12 @@ async function main() {
4949
publisher.close()
5050

5151
console.log("Opening a consumer and consuming messages...")
52-
const consumer = await connection.createConsumer(testQueue, {
53-
messageHandler: (msg) => console.log(`MessageId: ${msg.message_id}; Payload: ${msg.body}`),
52+
const consumer = await connection.createConsumer({
53+
queue: { name: testQueue },
54+
messageHandler: (context, msg) => {
55+
context.accept()
56+
console.log(`MessageId: ${msg.message_id}; Payload: ${msg.body}`)
57+
},
5458
})
5559
consumer.start()
5660
await sleep(5000)

0 commit comments

Comments
 (0)