From 48290c265ff3864b847921923f39d9243c3d13c6 Mon Sep 17 00:00:00 2001 From: Puck Wang Date: Wed, 11 Oct 2023 11:06:08 -0400 Subject: [PATCH] fix bug --- .../management/agent/publisher/HeartbeatGenerator.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/service/application/src/main/java/com/solace/maas/ep/event/management/agent/publisher/HeartbeatGenerator.java b/service/application/src/main/java/com/solace/maas/ep/event/management/agent/publisher/HeartbeatGenerator.java index d62f4b9f..bead520e 100644 --- a/service/application/src/main/java/com/solace/maas/ep/event/management/agent/publisher/HeartbeatGenerator.java +++ b/service/application/src/main/java/com/solace/maas/ep/event/management/agent/publisher/HeartbeatGenerator.java @@ -29,7 +29,7 @@ public HeartbeatGenerator(SolaceConfiguration solaceConfiguration, this.solacePublisher = solacePublisher; this.runtimeAgentId = eventPortalProperties.getRuntimeAgentId(); topic = solaceConfiguration.getTopicPrefix() + "heartbeat/v1"; - this.runtimeAgentVersion = buildProperties.getVersion().substring(0, buildProperties.getVersion().indexOf('-')); + this.runtimeAgentVersion = getFormattedVersion(buildProperties.getVersion()); } @Scheduled(fixedRate = 5000) @@ -38,4 +38,10 @@ public void sendHeartbeat() { solacePublisher.publish(message, topic); } + private String getFormattedVersion(String version) { + if (version.endsWith("-SNAPSHOT")) { + return version.replace("-SNAPSHOT", ""); + } + return version; + } }