- StreamNative Cloud
- Connect
Overview
You can use the following CLI tools and Pulsar clients to connect to a Pulsar cluster through the OAuth2 or Token authentication plugin.
Pulsar CLI tools
Pulsar clients
More code examples for the following Pulsar clients will be introduced in future releases.
- DotPulsar
- F# client
- Rust client
- Scala client
To use these Pulsar CLI tools or clients to connect to StreamNative Cloud, you need to get the service URLs, the OAuth2 file and authentication parameters, and the token.
Get a service URL
StreamNative Cloud Console provides four kinds of service URLs for a Pulsar cluster:
- HTTP service URL: the URL of a Pulsar cluster. After being granted the Admin access right, you can use the
pulsar-admin
orpulsarctl
CLI tool to connect to and manage the Pulsar cluster. - Broker service URL: the URL of a Pulsar cluster. After being granted the
produce
andcomsume
permissions, you can use thepulsar-client
CLI tool or Pulsar clients to connect to and communicate with the Pulsar cluster. - Websocket service URL: the URL for a Websocket-enabled Pulsar cluster. After being granted the Admin access right, you can use the WebSocket API to connect to and communicate with the Pulsar cluster.
- kafka service URL: the URL for a Kafka-enabled Pulsar cluster. After being granted the Admin access right, you can use the Kafka CLI tool or Kafka clients to connect to and communicate with the Pulsar cluster.
To get the service URL of a Pulsar cluster through the StreamNative Cloud Console, follow these steps.
On the left navigation pane, in the Admin area, click Pulsar Clusters.
Select the Overview tab, in the Access Points area, click Copy at the end of the row of the service URL you want to use.
Get an OAuth2 credential file
To get an OAuth2 credential file of a service account through the StreamNative Console, follow these steps.
On the left navigation pane, click Service Accounts.
In the row of the service account you want to use, in the Key File column, click the Download icon to download the OAuth2 credential file to your local directory.
The OAuth2 credential file should be something like this:
{ "type": "SN_SERVICE_ACCOUNT", "client_id": "CLIENT_ID", "client_secret": "CLIENT_SECRET", "client_email": "[email protected]", "issuer_url": "https://auth.streamnative.cloud" }
Get a token
A token has a system-defined Time-To-Live (TTL) of 7 days. Before a token expires, ensure that you generate a new token for your service account.
To get a token of a service account through the StreamNative Console, follow these steps.
On the left navigation pane, click Service Accounts.
In the row of the service account you want to use, in the Token column, click Generate new token, then click expires in 7 days to copy the token to your clipboard.