Skip to content

Commit

Permalink
Add cmd flag of retain key ordering (apache#8886)
Browse files Browse the repository at this point in the history
Signed-off-by: xiaolong.ran <[email protected]>

Fixes apache#6527 

### Motivation

We already support `key_shared` mode on Pulsar Functions in apache#7647, However, this option is not exposed in the command line parameters, so users currently cannot use this function.

### Modifications

In this pull request, we expose this cmd flag of `--retain-key-ordering` and add the docs for this.

### Verifying this change

The original test can cover this option, so, in this change, no relevant code is added
  • Loading branch information
wolfstudy authored Dec 11, 2020
1 parent 903675e commit 8150da8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ abstract class FunctionDetailsCommand extends BaseCommand {
protected Boolean DEPRECATED_retainOrdering;
@Parameter(names = "--retain-ordering", description = "Function consumes and processes messages in order")
protected Boolean retainOrdering;
@Parameter(names = "--retain-key-ordering", description = "Function consumes and processes messages in key order")
protected Boolean retainKeyOrdering;
@Parameter(names = "--batch-builder", description = "BatcherBuilder provides two types of batch construction methods, DEFAULT and KEY_BASED. The default value is: DEFAULT")
protected String batchBuilder;
@Parameter(names = "--forward-source-message-property", description = "Forwarding input message's properties to output topic when processing")
Expand Down Expand Up @@ -429,6 +431,10 @@ void processArguments() throws Exception {
functionConfig.setRetainOrdering(retainOrdering);
}

if (null != retainKeyOrdering) {
functionConfig.setRetainKeyOrdering(retainKeyOrdering);
}

if (isNotBlank(batchBuilder)) {
functionConfig.setBatchBuilder(batchBuilder);
}
Expand Down
3 changes: 3 additions & 0 deletions site2/docs/reference-pulsar-admin.md
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ Options
|`--fqfn`|The Fully Qualified Function Name (FQFN) for the function||
|`--max-message-retries`|How many times should we try to process a message before giving up||
|`--retain-ordering`|Function consumes and processes messages in order||
|`--retain-key-ordering`|Function consumes and processes messages in key order||
|`--timeout-ms`|The message timeout in milliseconds||
|`--tls-allow-insecure`|Allow insecure tls connection|false|
|`--tls-trust-cert-path`|The tls trust cert file path||
Expand Down Expand Up @@ -509,6 +510,7 @@ Options
|`--fqfn`|The Fully Qualified Function Name (FQFN) for the function||
|`--max-message-retries`|How many times should we try to process a message before giving up||
|`--retain-ordering`|Function consumes and processes messages in order||
|`--retain-key-ordering`|Function consumes and processes messages in key order||
|`--timeout-ms`|The message timeout in milliseconds||
|`--producer-config`| The custom producer configuration (as a JSON string) | |

Expand Down Expand Up @@ -573,6 +575,7 @@ Options
|`--fqfn`|The Fully Qualified Function Name (FQFN) for the function||
|`--max-message-retries`|How many times should we try to process a message before giving up||
|`--retain-ordering`|Function consumes and processes messages in order||
|`--retain-key-ordering`|Function consumes and processes messages in key order||
|`--timeout-ms`|The message timeout in milliseconds||
|`--producer-config`| The custom producer configuration (as a JSON string) | |

Expand Down

0 comments on commit 8150da8

Please sign in to comment.