-
Notifications
You must be signed in to change notification settings - Fork 425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ISSUE #3369][FEAT]create topic with broker addr or name or none #1087
base: master
Are you sure you want to change the base?
[ISSUE #3369][FEAT]create topic with broker addr or name or none #1087
Conversation
…o entire cluster) just like kafka sarama client
…rName`, and `notOverride`
Compare this to @Slideee PR (#1006), which tried to import a go-version JavaScript interpreter into the project, but that was only used in very small cases (json loading), so it is overkill for our limited needs. My solution is green and doesn't introduce any 3rd party heavyweight modules. furthermore, since it all uses native syntax or built-in libraries, it is better performance than adding a VM layer. Related to #1005 |
it's a nice feature! |
The code for this PR has been running stably within our company for more than half a year, indicating that there is no problem with the logic of the code itself. However, It is unclear what the maintainer @xujianhai666 thinks about this feature merge request? If there is a need for more test cases, or additional documentation or something, please let me know exactly what to do. |
What is the purpose of the change
Create Topic with optional argument:
createTopic
API with addressgetBrokerClusterInfo
, then resolve name to address, then invoke APIcreateTopic
on all addresses thatgetBrokerClusterInfo
returned.Brief changelog
GetBrokerClusterInfo
of Admin interface. in the meanwhile, there are integer type keys in RocketMQ Java Server response ofGetBrokerClusterInfo
, Golang JSON library cannot unmarshal them directly. So I fixed the JSON didn't conform to the JSON specification (JSON keys should always be strings, don't use int as a key).rocketmq-client-go/admin/admin.go
Line 39 in 7eedaf9
CreateTopic
implementation like sarama, withoutbrokerAddr
as input.rocketmq-client-go/admin/admin.go
Line 158 in 7eedaf9
createTopic
to avoid override same name topic configuration. for back compatibility, it is false by default.Verifying this change
I've update the
examples/admin/topic/main.go
file, which demonstrates all new features such as:furthermore, I also wrote UnitTest and BenchmarkTest for JSON integer key rectify function.
Related to apache/rocketmq#3369
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.