[rocketmq-replicator] Support create producer with connector's params… - #463
[rocketmq-replicator] Support create producer with connector's params…#463casuallc wants to merge 2 commits into
Conversation
# Conflicts: # connectors/rocketmq-replicator/src/main/java/org/apache/rocketmq/replicator/ReplicatorSourceTask.java
|
@odbozhou Please take a look. |
|
In my opinion, this pr has some conflicts with the design of connect
|
1 similar comment
|
In my opinion, this pr has some conflicts with the design of connect
|
|
The connector is depolyed alone , so we should not bind to only one rocketmq cluster. And then what's the meaning to config |
The purpose of dest.endpoint is to allow the replicator to connect itself to the current cluster, so that the ability to automatically create a target topic or automatically create a consumerGroup can be realized. In addition to the points mentioned above, it is also very important that the consumer side can use its perfect offset management mechanism to easily achieve at least one transmission. Because the producer logic is relatively simple, it can achieve at least one transmission in scenarios with poor network conditions. A transfer is more difficult. This is why replicator uses source to implement instead of sink. |
|
This PR has conflicts with the base branch and cannot be merged. Please rebase or merge the base branch into your branch and resolve the conflicts: git fetch origin
git checkout feature_replicator
git rebase origin/main
# resolve conflicts, then:
git push --force-with-leaseThis is a one-time reminder. Feel free to @mention me for a re-review after conflicts are resolved. Automated notification by github-manager-bot |
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
This PR modifies 5 file(s) with 354 lines of diff. No test changes detected — consider adding test coverage.
Automated review by github-manager-bot
| @@ -16,12 +16,23 @@ | |||
| */ | |||
There was a problem hiding this comment.
No test changes detected alongside source modifications. Consider adding tests to cover the changes.
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
PR received and logged for review. This PR requires detailed code review by a maintainer.
Diff size: 354 lines
Author: casuallc (CONTRIBUTOR)
Automated review by RockteMQ-AI
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Review of PR #463: [rocketmq-replicator] Support create producer with connector's params…
Findings: 3 issue(s) identified (0 critical).
CLA: unknown
Please address the inline comments above.
Automated review by github-manager-bot
| @@ -699,9 +717,9 @@ public void start(KeyValue config) { | |||
| connectorConfig.setDestInstanceId(config.getString(ReplicatorConnectorConfig.DEST_INSTANCEID)); | |||
| connectorConfig.setDestEndpoint(config.getString(ReplicatorConnectorConfig.DEST_ENDPOINT)); | |||
There was a problem hiding this comment.
The task still reads the destination endpoint from ReplicatorConnectorConfig.DEST_ENDPOINT, but ReplicatorSourceConnector now writes it under ConnectorConfig.RMQ_NAMESRVADDR. As a result, connectorConfig.getDestEndpoint() will be null in the task, which may break any logic that depends on the destination nameserver address.
| */ | ||
| public final static String USE_NAMESRV_OF_CONNECTOR = "use.namesrv.of.connector"; | ||
| public static final String RMQ_ACL_ENABLE = "rmq.acl.enable"; | ||
| public static final String RMQ_ACCESS_KEY = "rmq.access.key"; |
There was a problem hiding this comment.
RMQ_SECRET_KEY is defined as "rmq.secret_key" (underscore separator) while RMQ_ACCESS_KEY uses "rmq.access.key" (dot separator). This inconsistency is likely a typo and can cause user-provided secret keys to be ignored if they follow the dotted naming pattern of the other rmq.* keys.
| @@ -111,21 +109,49 @@ public static AllocateConnAndTaskStrategy initAllocateConnAndTaskStrategy(Worker | |||
| } | |||
There was a problem hiding this comment.
The new producer initialization overload that reads connector-level ACL/namesrv/group settings is not covered by any visible test changes. Consider adding unit tests for both the use.namesrv.of.connector=true and false branches, including cases where keys are missing.
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Re-review of PR #463 after new commits. The changes look good — proper refactoring to support connector-specific producer configuration with clean fallback to worker defaults.
Key improvements in this PR:
- Added
USE_NAMESRV_OF_CONNECTORflag to allow connectors to use their own namesrv address - Made
neededParamKeysstatic (fixes potential memory leak) - Removed duplicate
add(SRC_CLOUD)call - Changed
Boolean.valueOf()/Long.valueOf()toparseBoolean()/parseLong()(better practice for primitives) - Backward-compatible overload of
initDefaultMQProducer()
Findings
- [Info]
ConnectUtil.java:112— Consider adding Javadoc for the newUSE_NAMESRV_OF_CONNECTORflag
Verdict
LGTM. The code changes are well-structured and maintain backward compatibility.
Automated review by github-manager-bot
| } | ||
|
|
||
| public static DefaultMQProducer initDefaultMQProducer(WorkerConfig connectConfig) { | ||
| public static DefaultMQProducer initDefaultMQProducer(WorkerConfig connectConfig, ConnectKeyValue keyValue) { |
There was a problem hiding this comment.
[Info] The overloaded initDefaultMQProducer(WorkerConfig) method now delegates to the new method with null keyValue. This is a clean backward-compatible approach. Consider adding a brief Javadoc comment to explain the USE_NAMESRV_OF_CONNECTOR flag behavior for future maintainers.
What is the purpose of the change
In source task, producer is create with default config in
connect-standalone.conf.This commit support use connector's config to create producer.
Brief changelog
XX
Verifying this change
XXXX
Follow this checklist to help us incorporate your contribution quickly and easily. Notice,
it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR.[ISSUE #123] Fix UnknownException when host config not exist. Each commit in the pull request should have a meaningful subject line and body.mvn -B clean apache-rat:check findbugs:findbugs checkstyle:checkstyleto make sure basic checks pass. Runmvn clean install -DskipITsto make sure unit-test pass. Runmvn clean test-compile failsafe:integration-testto make sure integration-test pass.