Prerequisites
Before deploying a connector to StreamNative Cloud, make sure the following prerequisites have been met:
Create a built-in connector
Before creating a connector, it’s highly recommended to do the following:
- Check connector availability to ensure the version number of the connector you want to create is supported on StreamNative Cloud.
- Go to StreamNative Hub and find the connector-specific docs of your version for configuration reference.
The following example shows how to create a data generator source connector named test on StreamNative Cloud using different tools.
The builtin:// is followed by the name of the built-in connector, such as builtin://data-generator.
snctl
pulsarctl
pulsar-admin
Terraform
Rest API
To create a data generator source connector named test, run the following command.Replace $SERVICE_ACCOUNT with the StreamNative Cloud service account that the connector uses as its runtime identity. To select the runtime service account interactively, use --use-sn-service-account.Only Pulsar 4.0.x clusters running version 4.0.10.6 or later, or Pulsar 4.2.x clusters running version 4.2.1.4 or later, support the --sn-service-account flag.You can use --as-service-account instead of --sn-service-account if you are using other versions of Pulsar clusters.
You should see the following output:If you want to verify whether the data generator source connector has been created successfully, run the following command:You should see the following output:If you want to create a sink connector, use the snctl pulsar admin sinks create command.
To create a data generator source connector named test, run the following command.You should see the following output:If you want to verify whether the data generator source connector has been created successfully, run the following command:You should see the following output:If you want to create a sink connector, use the pulsarctl sinks create command.
To create a data generator source connector named test, run the following command.Replace the placeholder variables with the actual values that you can get when setting up client tools.
admin-url: the HTTP service URL of your Pulsar cluster.
private_key: the path to the downloaded OAuth2 key file.
audience: the Uniform Resource Name (URN), which is a combination of the urn:sn:pulsar, your organization name, and your Pulsar instance name.
If you want to list the submitted connector for a double check, run the following command:You should see the following output:To reduce the complexity of your command, you can add the above parameters with values into the conf/client.conf file under the downloaded Pulsar release. Once it’s configured, you can run a simple command instead:
- Add the following content to your Terraform file:
- Call the following commands in your Terraform file directory:
You can use snctl, pulsarctl or pulsar-admin to list the source connector submitted using Terraform.
To create a data generator source connector named test, run the following command.If you want to list the submitted connector for a double check, run the following command:
For all the common configurations of built-in connectors, see Configuration reference.
Pass sensitive configs to connector
Some connectors require sensitive information, such as passwords, token, to be passed to the connector. And you may not want to expose these sensitive information in the connector configuration.
To solve this problem, you can use the following methods to pass sensitive information to the connector:
-
Create a secret
For example, the AWS lambda sink connector requires the AWS access key and secret key to be passed to the connector.
You can create a secret in the console UI and pass the secret name to the connector configuration.
The location should be the same as the region of your Pulsar cluster.The awsAccessKey and awsSecretKey is the field name, and the lambda-sink-secret can be any unique name you want to give to the secret.
Only “sensitive” fields are able to load from secrets. You can get the list of sensitive fields from the connector configuration reference.
E.g. AWS lambda sink configurations
-
Pass secrets to the connector configuration
The following example shows how to create an AWS lambda sink connector named
test on StreamNative Cloud using different tools.
The builtin:// is followed by the name of the built-in connector, such as builtin://data-generator.
snctl
pulsarctl
pulsar-admin
Terraform
Rest API
To create an AWS lambda sink connector named test, run the following command.You should see the following output:The awsAccessKey and awsSecretKey is the field name, and the lambda-sink-secret is the secret name you created in UI.
If you want to verify whether the AWS lambda sink connector has been created successfully, run the following command:You should see the following output: To create an AWS lambda sink connector named test, run the following command.You should see the following output:The awsAccessKey and awsSecretKey is the field name, and the lambda-sink-secret is the secret name you created in UI.
If you want to verify whether the AWS lambda sink connector has been created successfully, run the following command:You should see the following output: To create an AWS lambda sink connector named test, run the following command.Replace the placeholder variables with the actual values that you can get when setting up client tools.
admin-url: the HTTP service URL of your Pulsar cluster.
private_key: the path to the downloaded OAuth2 key file.
audience: the Uniform Resource Name (URN), which is a combination of the urn:sn:pulsar, your organization name, and your Pulsar instance name.
If you want to list the submitted connector for a double check, run the following command:You should see the following output:The awsAccessKey and awsSecretKey is the field name, and the lambda-sink-secret is the secret name you created in UI.
To reduce the complexity of your command, you can add the above parameters with values into the conf/client.conf file under the downloaded Pulsar release. Once it’s configured, you can run a simple command instead:
- Add the following content to your Terraform file:
- Call the following commands in your Terraform file directory:
The awsAccessKey and awsSecretKey is the field name, and the lambda-sink-secret is the secret name you created in UI.
You can use snctl, pulsarctl or pulsar-admin to list the source connector submitted using Terraform.
To create an AWS lambda sink connector named test, run the following command.If you want to list the submitted connector for a double check, run the following command:The awsAccessKey and awsSecretKey is the field name, and the lambda-sink-secret is the secret name you created in UI.
For all the common configurations of built-in connectors, see Configuration reference.
Create a custom connector
Before creating a connector, it’s highly recommended to do the following:
- Check connector availability to ensure the version number of the connector you want to create is supported on StreamNative Cloud.
- Go to StreamNative Hub and find the connector-specific docs of your version for configuration reference.
To create a custom Pulsar Connector, you need to upload the connector jar/nar file to the StreamNative Cloud Package service first. Below are the steps:
Upload your connector file to Pulsar
snctl
Pulsarctl
Pulsar-admin
Upload packagesYou should see the following output:You can also upload your package to source://${tenant}/${namespace}/${name}@{$version}, currently Pulsar Package Service supports below protocols:
source://
sink://
function://
You need to set the context for Pulsarctl first:Replace the placeholder variables with the actual values that you can get when setting up client tools.
context-name: any name you want
admin-service-url: the HTTP service URL of your Pulsar cluster.
privateKey: the path to the downloaded OAuth2 key file.
issuerUrl: the URL of the OAuth2 issuer.
audience: the Uniform Resource Name (URN), which is a combination of the urn:sn:pulsar, your organization name, and your Pulsar instance name.
Upload packagesYou should see the following output:You can also upload your package to source://${tenant}/${namespace}/${name}@{$version}, currently Pulsar Package Service supports below protocols:
source://
sink://
function://
Replace the placeholder variables with the actual values that you can get when setting up client tools.
admin-url: the HTTP service URL of your Pulsar cluster.
privateKey: the path to the downloaded OAuth2 key file.
issuerUrl: the URL of the OAuth2 issuer.
audience: the Uniform Resource Name (URN), which is a combination of the urn:sn:pulsar, your organization name, and your Pulsar instance name.
You should see the following output:You can also upload your package to source://${tenant}/${namespace}/${name}@{$version}, currently Pulsar Package Service supports below protocols:
source://
sink://
function://
To create a custom connector, just replace the archive argument to the package URL(like sink://public/default/custom-connect@v1) you uploaded.