From 04a82294d6f89940453e2affa8061179afa843b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=8D=A1=E9=BE=99=E7=9C=BC?= Date: Mon, 17 May 2021 20:33:32 +0800 Subject: [PATCH] Add Alibaba Cloud RocketMQ pubsub Doc (#1405) * Add AliCloud RocketMQ pubsub Doc * Add Alibaba Cloud RocketMQ pubsub Doc Co-authored-by: Aaron Crawfis --- .../supported-pubsub/_index.md | 5 + .../setup-alicloud-rocketmq.md | 108 ++++++++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 daprdocs/content/en/reference/components-reference/supported-pubsub/setup-alicloud-rocketmq.md diff --git a/daprdocs/content/en/reference/components-reference/supported-pubsub/_index.md b/daprdocs/content/en/reference/components-reference/supported-pubsub/_index.md index 5fdc1a994..1e8602903 100644 --- a/daprdocs/content/en/reference/components-reference/supported-pubsub/_index.md +++ b/daprdocs/content/en/reference/components-reference/supported-pubsub/_index.md @@ -30,6 +30,11 @@ Table captions: | [RabbitMQ]({{< ref setup-rabbitmq.md >}}) | Alpha | v1 | 1.0 | | [Redis Streams]({{< ref setup-redis-pubsub.md >}}) | GA | v1 | 1.0 | +### Alibaba Cloud +| Name | Status | Component version | Since | +|---------------------------------------------------|--------| ---- |---------------| +| [Alibaba Cloud RocketMQ]({{< ref setup-alicloud-rocketmq.md >}}) | Alpha | v1 | 1.2 | + ### Amazon Web Services (AWS) | Name | Status | Component version | Since | diff --git a/daprdocs/content/en/reference/components-reference/supported-pubsub/setup-alicloud-rocketmq.md b/daprdocs/content/en/reference/components-reference/supported-pubsub/setup-alicloud-rocketmq.md new file mode 100644 index 000000000..ad823b599 --- /dev/null +++ b/daprdocs/content/en/reference/components-reference/supported-pubsub/setup-alicloud-rocketmq.md @@ -0,0 +1,108 @@ +--- +type: docs +title: "Alibaba Cloud RocketMQ" +linkTitle: "Alibaba Cloud RocketMQ" +description: "Detailed documentation on the Alibaba Cloud RocketMQ pubsub component" +--- + +## Component format +To setup Alibaba Cloud RocketMQ pubsub create a component of type `pubsub.rocketmq`. See [this guide]({{< ref "howto-publish-subscribe.md#step-1-setup-the-pubsub-component" >}}) on how to create and apply a pubsub configuration. + +### HTTP +```yaml +apiVersion: dapr.io/v1alpha1 +kind: Component +metadata: + name: + namespace: +spec: + type: pubsub.rocketmq + version: v1 + metadata: + - name: accessProto + value: "http" + - name: endpoint + value: "http://********.cn-qingdao-public.aliyuncs.com" + - name: accessKey + value: "****************" + - name: secretKey + value: "****************" + - name: consumerGroup + value: "GID_******" + - name: instanceId + value: "MQ_INST_******" +``` + +### TCP +```yaml +apiVersion: dapr.io/v1alpha1 +kind: Component +metadata: + name: + namespace: +spec: + type: pubsub.rocketmq + version: v1 + metadata: + - name: accessProto + value: "tcp" + - name: nameServer + value: "http://*************.aliyuncs.com:80" + - name: accessKey + value: "****************" + - name: secretKey + value: "****************" + - name: consumerGroup + value: "GID_******" + - name: instanceId + value: "MQ_INST_******" +``` + +{{% alert title="Warning" color="warning" %}} +The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described [here]({{< ref component-secrets.md >}}). +{{% /alert %}} + +## Spec metadata fields +| Field | Required | Details | Example | +|--------------------|:--------:|--------|---------| +| nameServer | N | RocketMQ's name server, optional| `"http://*************.aliyuncs.com:80"` +| endpoint | Y | RocketMQ's endpoint, optional, just for HTTP proto | `"http://********.cn-qingdao-public.aliyuncs.com"` +| accessProto | Y |sdk proto (HTTP or TCP),default TCP| `"tcp"` +| accessKey | N | RocketMQ Credentials| `"****************"` +| secretKey | N | RocketMQ Credentials | `"****************"` +| consumerGroup | N | consumer group for RocketMQ's subscribers, suggested to provide | `"GID_******"` +| consumerBatchSize | N | consumer group for RocketMQ's subscribers, suggested to provide, just for HTTP proto | `1024` +| consumerThreadNums | N |consumer group for RocketMQ's subscribers, suggested to provide, just for cgo proto | `20` +| instanceId | N | RocketMQ's namespace, optional | `"MQ_INST_******"` +| nameServerDomain | N |RocketMQ's name server domain, optional| `"mqrest.cn.aliyuncs.com"` +| retries | N | retry times to connect rocketmq's broker, optional | `0` +| content-type | N | msg's content-type eg:"application/cloudevents+json; charset=utf-8", application/octet-stream | `"text/plain"` + +## Create an AliCloud RocketMQ +Follow the instructions [here](https://www.alibabacloud.com/help/doc-detail/200153.htm) to setup AliCloud RocketMQ + - Simplified Chinese translation [here](https://help.aliyun.com/document_detail/200153.html) + +## Per-call metadata fields + +### Partition Key + +When invoking the rocketmq pub/sub, its possible to provide an optional partition key by using the `metadata` query param in the request url. + +You need specifie `rocketmq-tag`,`"rocketmq-key"` in `metadata` + +Example: + +```shell +curl -X POST http://localhost:3500/v1.0/publish/myRocketMQ/myTopic?metadata.rocketmq-tag=?&metadata.rocketmq-key=? \ + -H "Content-Type: application/json" \ + -d '{ + "data": { + "message": "Hi" + } + }' +``` + +## Related links +- [Basic schema for a Dapr component]({{< ref component-schema >}}) +- [Pub/Sub building block]({{< ref pubsub >}}) +- Read [this guide]({{< ref "howto-publish-subscribe.md#step-2-publish-a-topic" >}}) for instructions on configuring pub/sub components