Skip to content

Commit a5460ab

Browse files
committed
[ISSUE #3336]Modify consumergroup.event packages class attributes public to private
1 parent 7ec90de commit a5460ab

File tree

3 files changed

+35
-29
lines changed

3 files changed

+35
-29
lines changed

eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/consumergroup/event/ConsumerGroupStateEvent.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,16 @@
1919

2020
import org.apache.eventmesh.runtime.core.consumergroup.ConsumerGroupConf;
2121

22+
import lombok.Data;
23+
24+
@Data
2225
public class ConsumerGroupStateEvent {
2326

24-
public String consumerGroup;
25-
public ConsumerGroupStateAction action;
26-
public ConsumerGroupConf consumerGroupConfig;
27+
private String consumerGroup;
28+
29+
private ConsumerGroupStateAction action;
30+
31+
private ConsumerGroupConf consumerGroupConfig;
2732

2833
@Override
2934
public String toString() {

eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/consumergroup/event/ConsumerGroupTopicConfChangeEvent.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,18 @@
1919

2020
import org.apache.eventmesh.runtime.core.consumergroup.ConsumerGroupTopicConf;
2121

22+
import lombok.Data;
23+
24+
@Data
2225
public class ConsumerGroupTopicConfChangeEvent {
2326

24-
public ConsumerGroupTopicConfChangeAction action;
27+
private ConsumerGroupTopicConfChangeAction action;
2528

26-
public String topic;
29+
private String topic;
2730

28-
public String consumerGroup;
31+
private String consumerGroup;
2932

30-
public ConsumerGroupTopicConf newTopicConf;
33+
private ConsumerGroupTopicConf newTopicConf;
3134

3235
@Override
3336
public String toString() {

eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/consumer/ConsumerManager.java

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -65,26 +65,26 @@ public void notifyConsumerManager(String consumerGroup, ConsumerGroupConf latest
6565

6666
if (latestConsumerGroupConfig == null) {
6767
ConsumerGroupStateEvent notification = new ConsumerGroupStateEvent();
68-
notification.action = ConsumerGroupStateEvent.ConsumerGroupStateAction.DELETE;
69-
notification.consumerGroup = consumerGroup;
68+
notification.setAction(ConsumerGroupStateEvent.ConsumerGroupStateAction.DELETE);
69+
notification.setConsumerGroup(consumerGroup);
7070
eventMeshHTTPServer.getEventBus().post(notification);
7171
return;
7272
}
7373

7474
if (cgm == null) {
7575
ConsumerGroupStateEvent notification = new ConsumerGroupStateEvent();
76-
notification.action = ConsumerGroupStateEvent.ConsumerGroupStateAction.NEW;
77-
notification.consumerGroup = consumerGroup;
78-
notification.consumerGroupConfig = EventMeshUtil.cloneObject(latestConsumerGroupConfig);
76+
notification.setAction(ConsumerGroupStateEvent.ConsumerGroupStateAction.NEW);
77+
notification.setConsumerGroup(consumerGroup);
78+
notification.setConsumerGroupConfig(EventMeshUtil.cloneObject(latestConsumerGroupConfig));
7979
eventMeshHTTPServer.getEventBus().post(notification);
8080
return;
8181
}
8282

8383
if (!latestConsumerGroupConfig.equals(cgm.getConsumerGroupConfig())) {
8484
ConsumerGroupStateEvent notification = new ConsumerGroupStateEvent();
85-
notification.action = ConsumerGroupStateEvent.ConsumerGroupStateAction.CHANGE;
86-
notification.consumerGroup = consumerGroup;
87-
notification.consumerGroupConfig = EventMeshUtil.cloneObject(latestConsumerGroupConfig);
85+
notification.setAction(ConsumerGroupStateEvent.ConsumerGroupStateAction.CHANGE);
86+
notification.setConsumerGroup(consumerGroup);
87+
notification.setConsumerGroupConfig(EventMeshUtil.cloneObject(latestConsumerGroupConfig));
8888
eventMeshHTTPServer.getEventBus().post(notification);
8989
return;
9090
}
@@ -123,9 +123,7 @@ public synchronized void addConsumer(String consumerGroup, ConsumerGroupConf con
123123
/**
124124
* restart consumer
125125
*/
126-
public synchronized void restartConsumer(String consumerGroup,
127-
ConsumerGroupConf consumerGroupConfig)
128-
throws Exception {
126+
public synchronized void restartConsumer(String consumerGroup, ConsumerGroupConf consumerGroupConfig) throws Exception {
129127
if (consumerTable.containsKey(consumerGroup)) {
130128
ConsumerGroupManager cgm = consumerTable.get(consumerGroup);
131129
cgm.refresh(consumerGroupConfig);
@@ -159,29 +157,29 @@ public synchronized void delConsumer(String consumerGroup) throws Exception {
159157
public void handleConsumerGroupTopicConfChangeEvent(ConsumerGroupTopicConfChangeEvent event) {
160158
try {
161159
log.info("onChange event:{}", event);
162-
switch (event.action) {
160+
switch (event.getAction()) {
163161
case NEW: {
164-
ConsumerGroupManager manager = getConsumer(event.consumerGroup);
162+
ConsumerGroupManager manager = getConsumer(event.getConsumerGroup());
165163
if (Objects.isNull(manager)) {
166164
return;
167165
}
168-
manager.getConsumerGroupConfig().getConsumerGroupTopicConf().put(event.topic, event.newTopicConf);
166+
manager.getConsumerGroupConfig().getConsumerGroupTopicConf().put(event.getTopic(), event.getNewTopicConf());
169167
break;
170168
}
171169
case CHANGE: {
172-
ConsumerGroupManager manager = getConsumer(event.consumerGroup);
170+
ConsumerGroupManager manager = getConsumer(event.getConsumerGroup());
173171
if (Objects.isNull(manager)) {
174172
return;
175173
}
176-
manager.getConsumerGroupConfig().getConsumerGroupTopicConf().replace(event.topic, event.newTopicConf);
174+
manager.getConsumerGroupConfig().getConsumerGroupTopicConf().replace(event.getTopic(), event.getNewTopicConf());
177175
break;
178176
}
179177
case DELETE: {
180-
ConsumerGroupManager manager = getConsumer(event.consumerGroup);
178+
ConsumerGroupManager manager = getConsumer(event.getConsumerGroup());
181179
if (Objects.isNull(manager)) {
182180
return;
183181
}
184-
manager.getConsumerGroupConfig().getConsumerGroupTopicConf().remove(event.topic);
182+
manager.getConsumerGroupConfig().getConsumerGroupTopicConf().remove(event.getTopic());
185183
break;
186184
}
187185
default:
@@ -197,15 +195,15 @@ public void handleConsumerGroupStateEvent(ConsumerGroupStateEvent event) {
197195
try {
198196
log.info("onChange event:{}", event);
199197

200-
switch (event.action) {
198+
switch (event.getAction()) {
201199
case NEW:
202-
addConsumer(event.consumerGroup, event.consumerGroupConfig);
200+
addConsumer(event.getConsumerGroup(), event.getConsumerGroupConfig());
203201
break;
204202
case CHANGE:
205-
restartConsumer(event.consumerGroup, event.consumerGroupConfig);
203+
restartConsumer(event.getConsumerGroup(), event.getConsumerGroupConfig());
206204
break;
207205
case DELETE:
208-
delConsumer(event.consumerGroup);
206+
delConsumer(event.getConsumerGroup());
209207
break;
210208
default:
211209
//do nothing

0 commit comments

Comments
 (0)