Skip to content

Commit

Permalink
added appropriate getters and setters for HeartbeatEntity class in He…
Browse files Browse the repository at this point in the history
…artbeatRequestBody.java. updated EventMeshHttpConsumer.java to access aforementioned variables using correct setters. Updated HeartbeatProcessor.java to access aforementioned variables using correct getters.
  • Loading branch information
AaronGhebretinsae committed Jan 24, 2024
1 parent 73ab1d6 commit 1a9a346
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,46 @@ 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;

public String getTopic() {
return topic;
}

public void setTopic(String topic) {
this.topic = topic;
}

public String getServiceId() {
return serviceId;
}

public void setServiceId(String serviceId) {
this.serviceId = serviceId;
}

public String getUrl() {
return url;
}

public void setUrl(String url) {
this.url = url;
}

public String getInstanceId() {
return instanceId;
}

public void setInstanceId(String instanceId) {
this.instanceId = 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 1a9a346

Please sign in to comment.