Skip to content

Commit

Permalink
[ISSUE apache#3903] Unwritten public or protected field [HeartbeatReq…
Browse files Browse the repository at this point in the history
…uestBody] (apache#4757)

* added appropriate getters and setters for HeartbeatEntity class in HeartbeatRequestBody.java. updated EventMeshHttpConsumer.java to access aforementioned variables using correct setters. Updated HeartbeatProcessor.java to access aforementioned variables using correct getters.

* <Removed unnecessary getters and setters in eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/http/body/client/HeartbeatRequestBody.java >
  • Loading branch information
AaronGhebretinsae authored Jan 26, 2024
1 parent 032ff80 commit 8bb8b8f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,16 @@ public Map<String, Object> toMap() {
return map;
}

@ToString
@Data
public static class HeartbeatEntity {

public String topic;
public String serviceId;
public String url;
public String instanceId;
private String topic;
private String serviceId;
private String url;
private String instanceId;


}


}
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ public void processRequest(final ChannelHandlerContext ctx, final AsyncContext<H
client.setIp(heartbeatRequestHeader.getIp());
client.setPid(heartbeatRequestHeader.getPid());
client.setConsumerGroup(heartbeatRequestBody.getConsumerGroup());
client.setTopic(heartbeatEntity.topic);
client.setUrl(heartbeatEntity.url);
client.setTopic(heartbeatEntity.getTopic());
client.setUrl(heartbeatEntity.getUrl());
client.setLastUpTime(new Date());

if (StringUtils.isAnyBlank(client.getTopic(), client.getUrl())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ public void heartBeat(final List<SubscriptionItem> topicList, final String subsc
try {
final List<HeartbeatRequestBody.HeartbeatEntity> heartbeatEntities = topicList.stream().map(subscriptionItem -> {
final HeartbeatRequestBody.HeartbeatEntity heartbeatEntity = new HeartbeatRequestBody.HeartbeatEntity();
heartbeatEntity.topic = subscriptionItem.getTopic();
heartbeatEntity.url = subscribeUrl;
heartbeatEntity.setTopic(subscriptionItem.getTopic());
heartbeatEntity.setUrl(subscribeUrl);
return heartbeatEntity;
}).collect(Collectors.toList());

Expand Down

0 comments on commit 8bb8b8f

Please sign in to comment.