FrankChen021 commented on a change in pull request #11240:
URL: https://github.com/apache/druid/pull/11240#discussion_r659145770



##########
File path: docs/development/extensions-contrib/rocketmq-ingestion.md
##########
@@ -0,0 +1,414 @@
+---
+id: rocketmq-ingestion
+title: "Apache RocketMQ ingestion"
+sidebar_label: "Apache RocketMQ"
+---
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+
+The `RocketMQ` indexing service enables the configuration of *supervisors* on 
the Overlord, which facilitate ingestion from
+`RocketMQ` by managing the creation and lifetime of `RocketMQ` indexing tasks. 
These indexing tasks read events using `RocketMQ's` own
+message queue and offset mechanism and are therefore able to provide 
guarantees of exactly-once ingestion. Message queue is defined unique by 
+broker name and `queueID`, and message is in ordered stored in one message 
queue.
+The supervisor oversees the state of the indexing tasks to coordinate handoffs,
+manage failures, and ensure that the scalability and replication requirements 
are maintained.
+
+This service is provided in the `druid-rocketmq-indexing-service` contrib 
Apache Druid extension (see
+[Including Extensions](../../development/extensions.md#loading-extensions)).
+
+## Tutorial
+
+This page contains reference documentation for `Apache RocketMQ-based` 
ingestion.
+
+## Submitting a Supervisor Spec
+
+The `RocketMQ` indexing service requires that the 
`druid-rocketmq-indexing-service` extension be loaded on both the Overlord and 
the
+MiddleManagers. A supervisor for a dataSource is started by submitting a 
supervisor spec via HTTP POST to
+`http://<OVERLORD_IP>:<OVERLORD_PORT>/druid/indexer/v1/supervisor`, for 
example:
+
+```
+curl -X POST -H 'Content-Type: application/json' -d @supervisor-spec.json 
http://localhost:8090/druid/indexer/v1/supervisor
+```
+
+A sample supervisor spec is shown below:
+
+```json
+{
+  "type": "rocketmq",
+  "dataSchema": {
+    "dataSource": "metrics-rocketmq",
+    "timestampSpec": {
+      "column": "timestamp",
+      "format": "auto"
+    },
+    "dimensionsSpec": {
+      "dimensions": [],
+      "dimensionExclusions": [
+        "timestamp",
+        "value"
+      ]
+    },
+    "metricsSpec": [
+      {
+        "name": "count",
+        "type": "count"
+      },
+      {
+        "name": "value_sum",
+        "fieldName": "value",
+        "type": "doubleSum"
+      },
+      {
+        "name": "value_min",
+        "fieldName": "value",
+        "type": "doubleMin"
+      },
+      {
+        "name": "value_max",
+        "fieldName": "value",
+        "type": "doubleMax"
+      }
+    ],
+    "granularitySpec": {
+      "type": "uniform",
+      "segmentGranularity": "HOUR",
+      "queryGranularity": "NONE"
+    }
+  },
+  "ioConfig": {
+    "topic": "metrics",
+    "inputFormat": {
+      "type": "json"
+    },
+    "consumerProperties": {
+      "nameserver.url": "localhost:9876"
+    },
+    "taskCount": 1,
+    "replicas": 1,
+    "taskDuration": "PT1H"
+  },
+  "tuningConfig": {
+    "type": "rocketmq",
+    "maxRowsPerSegment": 5000000
+  }
+}
+```
+
+## Supervisor Configuration
+
+|Field|Description|Required|
+|--------|-----------|---------|
+|`type`|The supervisor type, this should always be `rocketmq`.|yes|
+|`dataSchema`|The schema that will be used by the `RocketMQ` indexing task 
during ingestion. See [`dataSchema`](../../ingestion/index.md#dataschema) for 
details.|yes|
+|`ioConfig`|A `RocketMQSupervisorIOConfig` object for configuring `RocketMQ` 
connection and I/O-related settings for the supervisor and indexing task. See 
[`RocketMQSupervisorIOConfig`](#rocketmqsupervisorioconfig) below.|yes|
+|`tuningConfig`|A `RocketMQSupervisorTuningConfig` object for configuring 
performance-related settings for the supervisor and indexing tasks. See 
[`RocketMQSupervisorTuningConfig`](#rocketmqsupervisortuningconfig) below.|no|
+
+### `RocketMQSupervisorIOConfig`
+
+|Field|Type|Description|Required|
+|-----|----|-----------|--------|
+|`topic`|String|The `RocketMQ` topic to read from. This must be a specific 
topic as topic patterns are not supported.|yes|
+|`inputFormat`|Object|[`inputFormat`](../../ingestion/data-formats.md#input-format)
 to specify how to parse input data. See [the below 
section](#specifying-data-format) for details about specifying the input 
format.|yes|
+|`consumerProperties`|Map<String, Object>|A map of properties to be passed to 
the `RocketMQ` consumer. See [next section](#more-on-consumerproperties) for 
more information.|yes|
+|`pollTimeout`|Long|The length of time to wait for the `RocketMQ` consumer to 
poll records, in milliseconds|no (default == 100)|
+|`replicas`|Integer|The number of replica sets, where 1 means a single set of 
tasks (no replication). Replica tasks will always be assigned to different 
workers to provide resiliency against process failure.|no (default == 1)|
+|`taskCount`|Integer|The maximum number of *reading* tasks in a *replica set*. 
This means that the maximum number of reading tasks will be `taskCount * 
replicas` and the total number of tasks (*reading* + *publishing*) will be 
higher than this. See [Capacity Planning](#capacity-planning) below for more 
details. The number of reading tasks will be less than `taskCount` if 
`taskCount > {numRocketMQMessageQueues}`.|no (default == 1)|
+|`taskDuration`|ISO8601 Period|The length of time before tasks stop reading 
and begin publishing their segment.|no (default == `PT1H`)|
+|`startDelay`|ISO8601 Period|The period to wait before the supervisor starts 
managing tasks.|no (default == `PT5S`)|
+|`period`|ISO8601 Period|How often the supervisor will execute its management 
logic. Note that the supervisor will also run in response to certain events 
(such as tasks succeeding, failing, and reaching their `taskDuration`) so this 
value specifies the maximum time between iterations.|no (default == `PT30S`)|
+|`useEarliestOffset`|Boolean|If a supervisor is managing a dataSource for the 
first time, it will obtain a set of starting offsets from `RocketMQ`. This flag 
determines whether it retrieves the earliest or latest offsets in `RocketMQ`. 
Under normal circumstances, subsequent tasks will start from where the previous 
segments ended so this flag will only be used on first run.|no (default == 
false)|
+|`completionTimeout`|ISO8601 Period|The length of time to wait before 
declaring a publishing task as failed and terminating it. If this is set too 
low, your tasks may never publish. The publishing clock for a task begins 
roughly after `taskDuration` elapses.|no (default == `PT30M`)|
+|`lateMessageRejectionStartDateTime`|ISO8601 DateTime|Configure tasks to 
reject messages with timestamps earlier than this date time; for example if 
this is set to `2016-01-01T11:00Z` and the supervisor creates a task at 
*`2016-01-01T12:00Z`*, messages with timestamps earlier than 
*`2016-01-01T11:00Z`* will be dropped. This may help prevent concurrency issues 
if your data stream has late messages and you have multiple pipelines that need 
to operate on the same segments (e.g. a realtime and a nightly batch ingestion 
pipeline).|no (default == none)|
+|`lateMessageRejectionPeriod`|ISO8601 Period|Configure tasks to reject 
messages with timestamps earlier than this period before the task was created; 
for example if this is set to `PT1H` and the supervisor creates a task at 
*`2016-01-01T12:00Z`*, messages with timestamps earlier than 
*`2016-01-01T11:00Z`* will be dropped. This may help prevent concurrency issues 
if your data stream has late messages and you have multiple pipelines that need 
to operate on the same segments (e.g. a realtime and a nightly batch ingestion 
pipeline). Please note that only one of `lateMessageRejectionPeriod` or 
`lateMessageRejectionStartDateTime` can be specified.|no (default == none)|
+|`earlyMessageRejectionPeriod`|ISO8601 Period|Configure tasks to reject 
messages with timestamps later than this period after the task reached its 
`taskDuration`; for example if this is set to `PT1H`, the `taskDuration` is set 
to `PT1H` and the supervisor creates a task at *`2016-01-01T12:00Z`*, messages 
with timestamps later than *`2016-01-01T14:00Z`* will be dropped. **Note:** 
Tasks sometimes run past their task duration, for example, in cases of 
supervisor failover. Setting `earlyMessageRejectionPeriod` too low may cause 
messages to be dropped unexpectedly whenever a task runs past its originally 
configured task duration.|no (default == none)|
+
+#### More on consumerProperties
+
+Now `consumerProperties` only support one property. This must contain a 
property `nameserver.url` with a list of `RocketMQ` name servers in the form: 
`<NAMESREV_1>:<PORT_1>;<NAMESREV_2>:<PORT_2>;...`.
+
+#### Specifying data format
+
+`RocketMQ` indexing service supports both 
[`inputFormat`](../../ingestion/data-formats.md#input-format) and 
[`parser`](../../ingestion/data-formats.md#parser) to specify the data format.
+The `inputFormat` is a new and recommended way to specify the data format for 
`RocketMQ` indexing service,
+but unfortunately, it doesn't support all data formats supported by the legacy 
`parser`.

Review comment:
       is `parser` supported by this extension ?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to