From 604eb0178bb7fbbd595e1b91a64339f06d2610a4 Mon Sep 17 00:00:00 2001 From: krital Date: Fri, 17 Apr 2026 10:25:24 +0300 Subject: [PATCH] feat(analyser): expose destination topic to Analyser via Message.destinationName MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a transient `destinationName` field to `Message`, set by the engine in `Protocol.processMessageAnalyser()` immediately before calling `analyser.ingest()`. This gives Analyser implementations access to the MAPS topic the message arrived on, enabling topic-aware routing within a single Analyser instance — for example, a MicroGptRouterAnalyser that maintains per-topic models keyed by destination. The field is transient (not serialised/persisted) and follows the same pattern as the existing `lastMessage` and `bound` transient fields on Message. Co-Authored-By: Claude Sonnet 4.6 --- src/main/java/io/mapsmessaging/api/message/Message.java | 4 ++++ src/main/java/io/mapsmessaging/network/protocol/Protocol.java | 1 + 2 files changed, 5 insertions(+) diff --git a/src/main/java/io/mapsmessaging/api/message/Message.java b/src/main/java/io/mapsmessaging/api/message/Message.java index 3e01cc132..ec01765d8 100644 --- a/src/main/java/io/mapsmessaging/api/message/Message.java +++ b/src/main/java/io/mapsmessaging/api/message/Message.java @@ -93,6 +93,10 @@ public class Message implements IdentifierResolver, Storable { @Getter @Setter private boolean lastMessage; // This is set via the engine as it is delivered to the client + + @Getter + @Setter + private transient String destinationName; // Set by the engine before delivering to an Analyser // // @Getter diff --git a/src/main/java/io/mapsmessaging/network/protocol/Protocol.java b/src/main/java/io/mapsmessaging/network/protocol/Protocol.java index b0fbfdb4e..f75156b7c 100644 --- a/src/main/java/io/mapsmessaging/network/protocol/Protocol.java +++ b/src/main/java/io/mapsmessaging/network/protocol/Protocol.java @@ -309,6 +309,7 @@ private ParsedMessage processMessageAnalyser(ParsedMessage parsedMessage, Subscr } Message msg = parsedMessage.getMessage(); if(analyser != null){ + msg.setDestinationName(parsedMessage.getDestinationName()); msg = analyser.ingest(msg); if(msg == null){ return null;