apache / apache/eventmesh

[Enhancement] Do some code optimization.[consumer.go]

Open
#3,772 1 comment 0 reactions 0 assignees View on GitHub
enhancement good first issue Stale
Dominant language
Java
Stars
1.8k
Forks
658
Avg merge
11h 29m
Merged PRs (30d)
52

Description

### Search before asking

- [X] I had searched in the [issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue) and found no similar issues.

### Enhancement Request

This issue is a subproject issue of eventmesh. the subproject address is:

https://github.com/apache/eventmesh-go

![image](https://user-images.githubusercontent.com/91315508/233284313-6fad5a9e-6639-4b20-8568-66a5d75f9877.png)
![image](https://user-images.githubusercontent.com/91315508/233284329-93021499-05ac-4583-a268-c1185eefe9c2.png)
located at:
eventmesh-go/plugin/connector/rocketmq/consumer.go line 105,140,173,186,219
analysis and expalanation:
186-221 lines are duplicate of `plugin/connector/rocketmq/consumer.go:140-175` (dupl)

### Describe the solution you'd like

Ranme _
![image](https://user-images.githubusercontent.com/91315508/233284412-657a75cd-960c-4d7a-a84f-6f2b5e9c39d9.png)

Repeat code extraction as method.
![image](https://user-images.githubusercontent.com/91315508/233284460-1bd24c14-a092-43b1-86b7-3bc1aeb7fb23.png)
![image](https://user-images.githubusercontent.com/91315508/233284473-0f02783d-4a17-4757-8a9a-0d1084ebe755.png)

### Are you willing to submit PR?

- [ ] Yes I am willing to submit a PR!

Contributor guide

Open the contributing guide

Research direction

Start by reading eventmesh-go/plugin/connector/rocketmq/consumer.go, especially lines 140-221, and compare the repeated sections identified in the issue. Extract the duplicated logic into a method as described, then confirm the duplicate code is removed while the consumer behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.