Skip to content

Commit 54e08e6

Browse files
committed
Refactor key constructing logic
1 parent 9ec57b7 commit 54e08e6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Diff for: ballerina/hub_controller.bal

+6-4
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ public isolated class Controller {
4646
}
4747
}
4848

49-
// todo: implement this logic properly
50-
isolated function retrieveKey(Subscription|Unsubscription message) returns string {
51-
string 'key = message.toJsonString().trim();
52-
return 'key;
49+
isolated function retrieveKey(record {} message) returns string {
50+
string[] keyValuePairs = [];
51+
foreach var [_, value] in message.entries() {
52+
keyValuePairs.push(string `${value.toString()}`);
53+
}
54+
return string:'join(":::", ...keyValuePairs);
5355
}

0 commit comments

Comments
 (0)