- Connect to External Systems
- Pulsar IO
Create Connectors
Prerequisites
Before deploying a connector to StreamNative Cloud, make sure the following prerequisites have been met:
A running external data system service.
A running Pulsar Cluster on StreamNative Cloud and the required environment has been set up.
At least one of the required tools: pulsarctl,
pulsar-admin
, or the Terraform module. For a quickstart of setting uppulsarctl
andpulsar-admin
, see set up client tools.
Create a built-in connector
Tip
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
.
To create a data generator source connector named test
, run the following command.
pulsarctl sources create --archive builtin://data-generator --destination-topic-name public/default/dg-test --source-config '{"sleepBetweenMessages": 60}' --name test
You should see the following output:
Created test successfully
If you want to verify whether the data generator source connector has been created successfully, run the following command:
pulsarctl sources list
You should see the following output:
+---------------------+
| PULSAR SOURCES NAME |
+---------------------+
| test |
+---------------------+
Tip
If you want to create a sink connector, use the pulsarctl sinks create
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.
Tip
The
location
should be the same as the region of your Pulsar cluster.The
awsAccessKey
andawsSecretKey
is the field name, and thelambda-sink-secret
can be any unique name you want to give to the secret.Tip
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. Thebuiltin://
is followed by the name of the built-in connector, such asbuiltin://data-generator
.To create an AWS lambda sink connector named
test
, run the following command.pulsarctl sinks create --archive builtin://aws-lambda --inputs public/default/lambda-sink-test --sink-config '{"awsRegion": "us-west-2","lambdaFunctionName": "test-hello","payloadFormat": "V2"}' --secrets '{"awsAccessKey":{"path":"lambda-sink-secret","key":"awsAccessKey"},"awsSecretKey":{"path":"lambda-sink-secret","key":"awsSecretKey"}}' --name test
You should see the following output:
Created test successfully
Tip
The
awsAccessKey
andawsSecretKey
is the field name, and thelambda-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:
pulsarctl sinks list
You should see the following output:
+---------------------+ | PULSAR SINKS NAME | +---------------------+ | test | +---------------------+
For all the common configurations of built-in connectors, see Configuration reference.