coders51 / rabbitmq-stream-js-client

rabbitmq-stream-js-client
MIT License
34 stars 5 forks source link

feat(super-stream): enable customized consumerRef, offset #191

Closed haile-vnm closed 7 months ago

haile-vnm commented 8 months ago

⛔Before

client.declareSuperStreamConsumer(
      {
        superStream: superStreamName
        // consumerRef: "super-stream-[random-uuid]", as default, can not change
        // offset: Offset.first(), as default, can not change
      },
      (message: Message) => {
        // handle message logic
      })

✅After

client.declareSuperStreamConsumer(
      {
        superStream: superStreamName,
        consumerRef: "consumer-group-name", // defined by user
        offset: Offset.next() // defined by user
      },
      (message: Message) => {
        // handle message logic
      })
haile-vnm commented 8 months ago

https://github.com/coders51/rabbitmq-stream-js-client/issues/190

icappello commented 7 months ago

Hello, sorry for the delay. We were unsure at first about allowing any type of offset for super-streams, in particular numeric and last offsets since the result on the consumer side depends on the number of partitions. That said, after a bit of internal discussion we agree on this behavior.

One note: the CI pipeline fails when performing the format check on a test file. Could you run a npm run format and update the PR?

haile-vnm commented 7 months ago

Hi @icappello ,

I fixed the format. Please help me to check it again. Thanks!