This is an automated email from the ASF dual-hosted git repository.
mytang0 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-eventmesh.git
The following commit(s) were added to refs/heads/master by this push:
new a5460ab51 [ISSUE #3336]Modify consumergroup.event packages class
attributes public to private
new d4e58ea22 Merge pull request #3337 from mxsm/eventmesh-3336
a5460ab51 is described below
commit a5460ab517f2bf4ce3a7aa29a6ae34a1089453f8
Author: mxsm <[email protected]>
AuthorDate: Sat Mar 4 01:19:48 2023 +0800
[ISSUE #3336]Modify consumergroup.event packages class attributes public to
private
---
.../event/ConsumerGroupStateEvent.java | 11 ++++--
.../event/ConsumerGroupTopicConfChangeEvent.java | 11 +++---
.../protocol/http/consumer/ConsumerManager.java | 42 +++++++++++-----------
3 files changed, 35 insertions(+), 29 deletions(-)
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/consumergroup/event/ConsumerGroupStateEvent.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/consumergroup/event/ConsumerGroupStateEvent.java
index 249461a87..99ace0e5f 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/consumergroup/event/ConsumerGroupStateEvent.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/consumergroup/event/ConsumerGroupStateEvent.java
@@ -19,11 +19,16 @@ package
org.apache.eventmesh.runtime.core.consumergroup.event;
import org.apache.eventmesh.runtime.core.consumergroup.ConsumerGroupConf;
+import lombok.Data;
+
+@Data
public class ConsumerGroupStateEvent {
- public String consumerGroup;
- public ConsumerGroupStateAction action;
- public ConsumerGroupConf consumerGroupConfig;
+ private String consumerGroup;
+
+ private ConsumerGroupStateAction action;
+
+ private ConsumerGroupConf consumerGroupConfig;
@Override
public String toString() {
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/consumergroup/event/ConsumerGroupTopicConfChangeEvent.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/consumergroup/event/ConsumerGroupTopicConfChangeEvent.java
index 2baa4e168..bfbb608c4 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/consumergroup/event/ConsumerGroupTopicConfChangeEvent.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/consumergroup/event/ConsumerGroupTopicConfChangeEvent.java
@@ -19,15 +19,18 @@ package
org.apache.eventmesh.runtime.core.consumergroup.event;
import org.apache.eventmesh.runtime.core.consumergroup.ConsumerGroupTopicConf;
+import lombok.Data;
+
+@Data
public class ConsumerGroupTopicConfChangeEvent {
- public ConsumerGroupTopicConfChangeAction action;
+ private ConsumerGroupTopicConfChangeAction action;
- public String topic;
+ private String topic;
- public String consumerGroup;
+ private String consumerGroup;
- public ConsumerGroupTopicConf newTopicConf;
+ private ConsumerGroupTopicConf newTopicConf;
@Override
public String toString() {
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/consumer/ConsumerManager.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/consumer/ConsumerManager.java
index ffc74a722..ee0ca34cb 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/consumer/ConsumerManager.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/consumer/ConsumerManager.java
@@ -65,26 +65,26 @@ public class ConsumerManager {
if (latestConsumerGroupConfig == null) {
ConsumerGroupStateEvent notification = new
ConsumerGroupStateEvent();
- notification.action =
ConsumerGroupStateEvent.ConsumerGroupStateAction.DELETE;
- notification.consumerGroup = consumerGroup;
+
notification.setAction(ConsumerGroupStateEvent.ConsumerGroupStateAction.DELETE);
+ notification.setConsumerGroup(consumerGroup);
eventMeshHTTPServer.getEventBus().post(notification);
return;
}
if (cgm == null) {
ConsumerGroupStateEvent notification = new
ConsumerGroupStateEvent();
- notification.action =
ConsumerGroupStateEvent.ConsumerGroupStateAction.NEW;
- notification.consumerGroup = consumerGroup;
- notification.consumerGroupConfig =
EventMeshUtil.cloneObject(latestConsumerGroupConfig);
+
notification.setAction(ConsumerGroupStateEvent.ConsumerGroupStateAction.NEW);
+ notification.setConsumerGroup(consumerGroup);
+
notification.setConsumerGroupConfig(EventMeshUtil.cloneObject(latestConsumerGroupConfig));
eventMeshHTTPServer.getEventBus().post(notification);
return;
}
if (!latestConsumerGroupConfig.equals(cgm.getConsumerGroupConfig())) {
ConsumerGroupStateEvent notification = new
ConsumerGroupStateEvent();
- notification.action =
ConsumerGroupStateEvent.ConsumerGroupStateAction.CHANGE;
- notification.consumerGroup = consumerGroup;
- notification.consumerGroupConfig =
EventMeshUtil.cloneObject(latestConsumerGroupConfig);
+
notification.setAction(ConsumerGroupStateEvent.ConsumerGroupStateAction.CHANGE);
+ notification.setConsumerGroup(consumerGroup);
+
notification.setConsumerGroupConfig(EventMeshUtil.cloneObject(latestConsumerGroupConfig));
eventMeshHTTPServer.getEventBus().post(notification);
return;
}
@@ -123,9 +123,7 @@ public class ConsumerManager {
/**
* restart consumer
*/
- public synchronized void restartConsumer(String consumerGroup,
- ConsumerGroupConf consumerGroupConfig)
- throws Exception {
+ public synchronized void restartConsumer(String consumerGroup,
ConsumerGroupConf consumerGroupConfig) throws Exception {
if (consumerTable.containsKey(consumerGroup)) {
ConsumerGroupManager cgm = consumerTable.get(consumerGroup);
cgm.refresh(consumerGroupConfig);
@@ -159,29 +157,29 @@ public class ConsumerManager {
public void
handleConsumerGroupTopicConfChangeEvent(ConsumerGroupTopicConfChangeEvent
event) {
try {
log.info("onChange event:{}", event);
- switch (event.action) {
+ switch (event.getAction()) {
case NEW: {
- ConsumerGroupManager manager =
getConsumer(event.consumerGroup);
+ ConsumerGroupManager manager =
getConsumer(event.getConsumerGroup());
if (Objects.isNull(manager)) {
return;
}
-
manager.getConsumerGroupConfig().getConsumerGroupTopicConf().put(event.topic,
event.newTopicConf);
+
manager.getConsumerGroupConfig().getConsumerGroupTopicConf().put(event.getTopic(),
event.getNewTopicConf());
break;
}
case CHANGE: {
- ConsumerGroupManager manager =
getConsumer(event.consumerGroup);
+ ConsumerGroupManager manager =
getConsumer(event.getConsumerGroup());
if (Objects.isNull(manager)) {
return;
}
-
manager.getConsumerGroupConfig().getConsumerGroupTopicConf().replace(event.topic,
event.newTopicConf);
+
manager.getConsumerGroupConfig().getConsumerGroupTopicConf().replace(event.getTopic(),
event.getNewTopicConf());
break;
}
case DELETE: {
- ConsumerGroupManager manager =
getConsumer(event.consumerGroup);
+ ConsumerGroupManager manager =
getConsumer(event.getConsumerGroup());
if (Objects.isNull(manager)) {
return;
}
-
manager.getConsumerGroupConfig().getConsumerGroupTopicConf().remove(event.topic);
+
manager.getConsumerGroupConfig().getConsumerGroupTopicConf().remove(event.getTopic());
break;
}
default:
@@ -197,15 +195,15 @@ public class ConsumerManager {
try {
log.info("onChange event:{}", event);
- switch (event.action) {
+ switch (event.getAction()) {
case NEW:
- addConsumer(event.consumerGroup,
event.consumerGroupConfig);
+ addConsumer(event.getConsumerGroup(),
event.getConsumerGroupConfig());
break;
case CHANGE:
- restartConsumer(event.consumerGroup,
event.consumerGroupConfig);
+ restartConsumer(event.getConsumerGroup(),
event.getConsumerGroupConfig());
break;
case DELETE:
- delConsumer(event.consumerGroup);
+ delConsumer(event.getConsumerGroup());
break;
default:
//do nothing
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]