How to use the pulsar-client.MessageId function in pulsar-client

To help you get started, we’ve selected a few pulsar-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apache / pulsar-client-node / examples / reader.js View on Github external
(async () => {
  // Create a client
  const client = new Pulsar.Client({
    serviceUrl: 'pulsar://localhost:6650',
    operationTimeoutSeconds: 30,
  });

  // Create a reader
  const reader = await client.createReader({
    topic: 'persistent://public/default/my-topic',
    startMessageId: Pulsar.MessageId.earliest(),
  });

  // read messages
  for (let i = 0; i < 10; i += 1) {
    const msg = await reader.readNext();
    console.log(msg.getData().toString());
  }

  await reader.close();
  await client.close();
})();

pulsar-client

Pulsar Node.js client

Apache-2.0
Latest version published 3 months ago

Package Health Score

72 / 100
Full package analysis

Similar packages