Skip to content

Stream Native Cloud

Chris Bono edited this page Dec 3, 2022 · 7 revisions

Follow these steps to use a Pulsar service hosted in the StreamNative Cloud.

Pre-requisites

Follow the Stream Native Quickstart to create a cloud instance.

Steps

Obtain the required configuration property values


Navigate to "Pulsar Clusters" in the Stream Native UI.

  • <service-url> - copy "Broker Service URL (TLS)" (eg. pulsar+ssl://foo.streamnative.g.snio.cloud:6651)

  • <admin service-url> - copy "HTTP Service URL (TLS)" (eg. https://foo.streamnative.g.snio.cloud)


Navigate to "Service Accounts" in the Stream Native UI and find the row of the account you will use to connect to the cluster with. Click the "Generate New Token" button to generate an authentication token.

  • <token> - click the "Copy" icon next to the "Expires In 7 Days" label to copy the token.

Use the required configuration property values

Add the following to your application.yml (or other property source):

spring:
  pulsar:
    client:
      auth-plugin-class-name: org.apache.pulsar.client.impl.auth.AuthenticationToken
      authentication:
        token: <token>
      service-url: <service-url>
    administration:
      auth-plugin-class-name: org.apache.pulsar.client.impl.auth.AuthenticationToken
      authentication:
        token: <token>
      service-url: <admin service-url>

Run your application

Launch your application and you should be on your way to Happy Streaming!

Tip
If you encounter errors on application startup with status 401 it is likely the account you are connecting with does not have access to the tenant/namespace your topic is in. Try fully-qualifying your topic names such as persistent://my-tenant/my-namespace/my-topic and be sure your account has access to the topic(s).