summaryrefslogtreecommitdiffstats
path: root/documentapi
diff options
context:
space:
mode:
Diffstat (limited to 'documentapi')
-rw-r--r--documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusAsyncSession.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusAsyncSession.java b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusAsyncSession.java
index a2bad9c84e1..33286d227bf 100644
--- a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusAsyncSession.java
+++ b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusAsyncSession.java
@@ -143,6 +143,14 @@ public class MessageBusAsyncSession implements MessageBusSession, AsyncSession {
return send(msg);
}
+ private boolean mayOverrideWithGetOnlyRoute(Message msg) {
+ // Only allow implicitly overriding the default Get route if the message is attempted sent
+ // with the default route originally. Otherwise it's reasonable to assume that the caller
+ // has some explicit idea of why the regular route is set to the value it is.
+ return ((msg.getType() == DocumentProtocol.MESSAGE_GETDOCUMENT)
+ && ("default".equals(route) || "route:default".equals(route)));
+ }
+
/**
* A convenience method for assigning the internal trace level and route string to a message before sending it
* through the internal mbus session object.
@@ -155,7 +163,7 @@ public class MessageBusAsyncSession implements MessageBusSession, AsyncSession {
long reqId = requestId.incrementAndGet();
msg.setContext(reqId);
msg.getTrace().setLevel(traceLevel);
- String toRoute = (msg.getType() == DocumentProtocol.MESSAGE_GETDOCUMENT ? routeForGet : route);
+ String toRoute = (mayOverrideWithGetOnlyRoute(msg) ? routeForGet : route);
if (toRoute != null) {
return toResult(reqId, session.send(msg, toRoute, true));
} else {