Support for RabbitMQ Streams
paul-bell opened this issue · 3 comments
paul-bell commented
Hello,
Does your amqp-client support RabbitMQ Streams ( https://www.rabbitmq.com/streams.html )?
If so, can you please post an example?
Thank you.
-Paul
carlhoerberg commented
Yes:
import { AMQPClient } from '../lib/mjs/amqp-client.js'
async function run() {
const amqp = new AMQPClient("amqp://localhost")
const conn = await amqp.connect()
let ch = await conn.channel()
await ch.prefetch(100)
let q = await ch.queue("stream1", {}, {"x-queue-type": "stream" })
const consumer = await q.subscribe({noAck: false, args: {"x-stream-offset": "first"}}, (msg) => {
console.log(msg.bodyString())
msg.ack()
})
await consumer.wait()
}
await run()
carlhoerberg commented
Example added to repo too: https://github.com/cloudamqp/amqp-client.js/blob/main/examples/stream.js
Please let me know if you have more questions.
paul-bell commented
Thank you, Carl.