Skip to content

Instantly share code, notes, and snippets.

@Sraleik
Created September 9, 2021 13:34
Show Gist options
  • Save Sraleik/13cf3c6b916c703e0eb2b007c37dff02 to your computer and use it in GitHub Desktop.
Save Sraleik/13cf3c6b916c703e0eb2b007c37dff02 to your computer and use it in GitHub Desktop.
clever-pulsar
import Pulsar from 'pulsar-client';
(async () => {
const token = new Pulsar.AuthenticationToken({ token: 'fake-token' })
const client = new Pulsar.Client({
serviceUrl: 'pulsar+ssl://c2-pulsar-clevercloud-customers.services.clever-cloud.com:2002',
authentication: token,
});
const producer = await client.createProducer({
topic: 'persistent://user_5db919b8-f988-4c72-a269-f8d0f62cef22/pulsar_39f5266a-b0ab-4441-a787-18f897afa796/my-topic',
});
const res = await producer.send({
data: Buffer.from('test'),
});
await client.close();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment