Skip to content

Commit

Permalink
Refactor create a connector section docs. (#773)
Browse files Browse the repository at this point in the history
(cherry picked from commit 3259849)
  • Loading branch information
shibd committed Dec 11, 2023
1 parent 0c06826 commit 5d07845
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 56 deletions.
74 changes: 46 additions & 28 deletions docs/amqp-1-0-sink.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,54 @@ docker run -d -p 8080:8080 -p:8008:8008 -p:1883:1883 -p:8000:8000 -p:5672:5672 -

### 2. Create a connector

Depending on the environment, there are several ways to create an AMQP 1.0 sink connector:

- [Create Connector on StreamNative Cloud](https://docs.streamnative.io/docs/connector-create).
- [Create Connector with Function worker](https://pulsar.apache.org/docs/3.0.x/io-quickstart/).
Using this way requires you to download a **NAR** package to create a built-in or non-built-in connector. You can download the version you need from [here](https://github.com/streamnative/pulsar-io-amqp-1-0/releases).
- [Create Connector with Function mesh](https://functionmesh.io/docs/connectors/run-connector).
Using this way requires you to set the docker image. You can choose the version you want to launch from [here](https://hub.docker.com/r/streamnative/pulsar-io-amqp-1-0/tags)

No matter how you create an AMQP 1.0 sink connector, the minimum configuration contains the following parameters.

```yaml
configs:
connection:
failover:
useFailover: true
uris:
- protocol: amqp
host: localhost
port: 5672
urlOptions:
- transport.tcpKeepAlive=true
username: guest
password: guest
queue: user-op-queue-pulsar
The following command shows how to use [pulsarctl](https://github.com/streamnative/pulsarctl) to create a `builtin` connector. If you want to create a `non-builtin` connector,
you need to replace `--sink-type amqp1_0` with `--archive /path/to/pulsar-io-amqp1_0.nar`. You can find the button to download the `nar` package at the beginning of the document.

{% callout title="For StreamNative Cloud User" type="note" %}
If you are a StreamNative Cloud user, you need [set up your environment](https://docs.streamnative.io/docs/connector-setup) first.
{% /callout %}

```bash
pulsarctl sinks create \
--sink-type amqp1_0 \
--name amqp1_0-sink \
--tenant public \
--namespace default \
--inputs "Your topic name" \
--parallelism 1 \
--sink-config \
'{
"connection": {
"failover": {
"useFailover": true
},
"uris": [
{
"protocol": "amqp",
"host": "localhost",
"port": 5672,
"urlOptions": [
"transport.tcpKeepAlive=true"
]
}
]
},
"username": "guest",
"password": "guest",
"queue": "user-op-queue-pulsar"
}'
```

> * The configuration structure varies depending on how you create the AMQP 1.0 sink connector.
> For example, some are **JSON**, some are **YAML**, and some are **Kubernetes YAML**. You need to adapt the configs to the corresponding format.
>
> * If you want to configure more parameters, see [Configuration Properties](#configuration-properties) for reference.
The `--sink-config` is the minimum necessary configuration for starting this connector, and it is a JSON string. You need to substitute the relevant parameters with your own.
If you want to configure more parameters, see [Configuration Properties](#configuration-properties) for reference.

{% callout title="Note" type="note" %}
You can also choose to use a variety of other tools to create a connector:
- [pulsar-admin](https://pulsar.apache.org/docs/3.1.x/io-use/): The command arguments for `pulsar-admin` are similar to those of `pulsarctl`. You can find an example for [StreamNative Cloud Doc](https://docs.streamnative.io/docs/connector-create#create-a-built-in-connector ).
- [RestAPI](https://pulsar.apache.org/sink-rest-api/?version=3.1.1): You can find an example for [StreamNative Cloud Doc](https://docs.streamnative.io/docs/connector-create#create-a-built-in-connector).
- [Terraform](https://github.com/hashicorp/terraform): You can find an example for [StreamNative Cloud Doc](https://docs.streamnative.io/docs/connector-create#create-a-built-in-connector).
- [Function Mesh](https://functionmesh.io/docs/connectors/run-connector): The docker image can be found at the beginning of the document.
{% /callout %}

### 2. Send messages to the topic

Expand Down
74 changes: 46 additions & 28 deletions docs/amqp-1-0-source.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,54 @@ docker run -d -p 8080:8080 -p:8008:8008 -p:1883:1883 -p:8000:8000 -p:5672:5672 -

### 2. Create a connector

Depending on the environment, there are several ways to create an AMQP 1.0 sink connector:

- [Create Connector on StreamNative Cloud](https://docs.streamnative.io/docs/connector-create).
- [Create Connector with Function worker](https://pulsar.apache.org/docs/3.0.x/io-quickstart/).
Using this way requires you to download a **NAR** package to create a built-in or non-built-in connector. You can download the version you need from [here](https://github.com/streamnative/pulsar-io-amqp-1-0/releases).
- [Create Connector with Function mesh](https://functionmesh.io/docs/connectors/run-connector).
Using this way requires you to set the docker image. You can choose the version you want to launch from [here](https://hub.docker.com/r/streamnative/pulsar-io-amqp-1-0/tags)

No matter how you create an AMQP 1.0 sink connector, the minimum configuration contains the following parameters.

```yaml
configs:
connection:
failover:
useFailover: true
uris:
- protocol: amqp
host: localhost
port: 5672
urlOptions:
- transport.tcpKeepAlive=true
username: guest
password: guest
queue: user-op-queue-pulsar
The following command shows how to use [pulsarctl](https://github.com/streamnative/pulsarctl) to create a `builtin` connector. If you want to create a `non-builtin` connector,
you need to replace `--source-type amqp1_0` with `--archive /path/to/pulsar-io-amqp1_0.nar`. You can find the button to download the `nar` package at the beginning of the document.

{% callout title="For StreamNative Cloud User" type="note" %}
If you are a StreamNative Cloud user, you need [set up your environment](https://docs.streamnative.io/docs/connector-setup) first.
{% /callout %}

```bash
pulsarctl sources create \
--source-type amqp1_0 \
--name amqp1_0-source \
--tenant public \
--namespace default \
--destination-topic-name "Your topic name" \
--parallelism 1 \
--source-config \
'{
"connection": {
"failover": {
"useFailover": true
},
"uris": [
{
"protocol": "amqp",
"host": "localhost",
"port": 5672,
"urlOptions": [
"transport.tcpKeepAlive=true"
]
}
]
},
"username": "guest",
"password": "guest",
"queue": "user-op-queue-pulsar"
}'
```

> * The configuration structure varies depending on how you create the AMQP 1.0 sink connector.
> For example, some are **JSON**, some are **YAML**, and some are **Kubernetes YAML**. You need to adapt the configs to the corresponding format.
>
> * If you want to configure more parameters, see [Configuration Properties](#configuration-properties) for reference.
The `--source-config` is the minimum necessary configuration for starting this connector, and it is a JSON string. You need to substitute the relevant parameters with your own.
If you want to configure more parameters, see [Configuration Properties](#configuration-properties) for reference.

{% callout title="Note" type="note" %}
You can also choose to use a variety of other tools to create a connector:
- [pulsar-admin](https://pulsar.apache.org/docs/3.1.x/io-use/): The command arguments for `pulsar-admin` are similar to those of `pulsarctl`. You can find an example for [StreamNative Cloud Doc](https://docs.streamnative.io/docs/connector-create#create-a-built-in-connector ).
- [RestAPI](https://pulsar.apache.org/source-rest-api/?version=3.1.1): You can find an example for [StreamNative Cloud Doc](https://docs.streamnative.io/docs/connector-create#create-a-built-in-connector).
- [Terraform](https://github.com/hashicorp/terraform): You can find an example for [StreamNative Cloud Doc](https://docs.streamnative.io/docs/connector-create#create-a-built-in-connector).
- [Function Mesh](https://functionmesh.io/docs/connectors/run-connector): The docker image can be found at the beginning of the document.
{% /callout %}

### 2. Send messages to the AMQP 1.0 service

Expand Down

0 comments on commit 5d07845

Please sign in to comment.