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 d62f4b9ff..bead520e0 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; + } }