You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/07/16 12:19:21 UTC
[GitHub] [pulsar-client-node] freeart opened a new pull request #37: added
serialize/deserialize methods to set custom startMessageId in createReader
freeart opened a new pull request #37: added serialize/deserialize methods to set custom startMessageId in createReader
URL: https://github.com/apache/pulsar-client-node/pull/37
To restore Reader from the custom message needs to provide startMessageId
```js
const msg = await reader.readNext();
const msgId = msg.getMessageId().serialize() // native Buffer
msgId.toString("hex") // returns "085a10002000" as binary string
```
The cursor can be restored from binary string
```js
const msgId = Buffer.from("085a10002000", "hex")
const reader = await client.createReader({
topic: 'persistent://public/default/my-topic',
startMessageId: Pulsar.MessageId.deserialize(msgId)
});
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services