Skip to content

Commit 7849085

Browse files
CesarCoelhoclaude
andcommitted
Skip address lookup for PUBLISH error messages (fixes #9)
A publish error is returned to the publisher as a PUBLISH message with the isError flag set. The publisher is not a MAL provider for the PUBLISH operation, so the unconditional lookupAddress at the _PUBLISH_STAGE dispatch always failed for it and logged a spurious warning: "lookupAddress failed to find local endpoint for ...". Delivery of the error was unaffected because handlePublish already ignores the address for error messages and dispatches via the publish listener map. Only perform the address lookup for non-error PUBLISH messages (the broker path). The NOTIFY path already avoided the lookup. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 878a490 commit 7849085

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

mal-impl/src/main/java/esa/mo/mal/impl/MALReceiver.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,15 @@ public void onMessage(final MALEndpoint callingEndpoint, MALMessage msg) {
189189
handlePublishRegister(msg, address);
190190
break;
191191
case MALPubSubOperation._PUBLISH_STAGE:
192-
address = lookupAddress(callingEndpoint, null);
192+
// Only brokers hold a provider endpoint for the PUBLISH
193+
// operation. A publish error is returned to the publisher
194+
// as a PUBLISH message with the isError flag set; the
195+
// publisher is not a provider, so looking up its (absent)
196+
// address would only log a spurious warning. handlePublish
197+
// does not use the address for error messages anyway.
198+
if (!msg.getHeader().getIsErrorMessage()) {
199+
address = lookupAddress(callingEndpoint, null);
200+
}
193201
handlePublish(msg, address);
194202
break;
195203
case MALPubSubOperation._NOTIFY_STAGE:

0 commit comments

Comments
 (0)