From 54e08e6f0c69a90e9f7dad742450b11be19cb1c9 Mon Sep 17 00:00:00 2001 From: Ayesh Almeida Date: Mon, 17 Feb 2025 20:07:06 +0530 Subject: [PATCH] Refactor key constructing logic --- ballerina/hub_controller.bal | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ballerina/hub_controller.bal b/ballerina/hub_controller.bal index 48ed8fe7..10eedf6d 100644 --- a/ballerina/hub_controller.bal +++ b/ballerina/hub_controller.bal @@ -46,8 +46,10 @@ public isolated class Controller { } } -// todo: implement this logic properly -isolated function retrieveKey(Subscription|Unsubscription message) returns string { - string 'key = message.toJsonString().trim(); - return 'key; +isolated function retrieveKey(record {} message) returns string { + string[] keyValuePairs = []; + foreach var [_, value] in message.entries() { + keyValuePairs.push(string `${value.toString()}`); + } + return string:'join(":::", ...keyValuePairs); }