Fix #309: make channelName available in Postprocessor script - #395
Open
ggiannola wants to merge 2 commits into
Open
Fix #309: make channelName available in Postprocessor script#395ggiannola wants to merge 2 commits into
ggiannola wants to merge 2 commits into
Conversation
ggiannola
marked this pull request as ready for review
July 29, 2026 18:09
ggiannola
requested review from
a team,
NicoPiel,
gibson9583,
jonbartels,
kayyagari,
kpalang,
pacmano1 and
ssrowe
July 29, 2026 18:09
…essor script The Postprocessor scope derives channelName from message.getMergedConnectorMessage().getChannelName(), but Message.getMergedConnectorMessage() never populated channelName on the merged ConnectorMessage. As a result the channelName variable was null in Postprocessor scripts, even though it is available in Deploy, Undeploy, and Preprocessor scripts. Populate channelName on the merged connector message from the Message's own channelName, falling back to the source connector message's channelName (which is reliably set during processing). Adds MessageTest covering the three cases. Signed-off-by: Giovanni Giannola <[email protected]>
New files in this project use SPDX headers attributing copyright to the contributor, rather than the legacy Mirth Corporation header carried by pre-fork files. Signed-off-by: Giovanni Giannola <[email protected]>
ggiannola
force-pushed
the
fix/309-postprocessor-channelname
branch
from
July 29, 2026 18:14
cfe7bcb to
0de1890
Compare
Contributor
|
@ggiannola, this works in the post processor. logger.info(ChannelUtil.getChannelName(channelId))Not that your PR is "wrong", but based on this trivial workaround it seems unnecessary. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #309. The
channelNamevariable was not available in Postprocessor scripts, even though it is available in Deploy, Undeploy, and Preprocessor scripts.Root cause
The Postprocessor scope (
JavaScriptScopeUtil.getPostprocessorScope) deriveschannelNamefrommessage.getMergedConnectorMessage().getChannelName().However,
Message.getMergedConnectorMessage()built the mergedConnectorMessagesettingchannelId,messageId,serverId, andreceivedDate— but neverchannelName. The value therefore resolved tonullin Postprocessor scripts.This also explains why the other script contexts were unaffected: they receive the channel name directly (Deploy/Undeploy via
getDeployScope/getUndeployScope, Preprocessor from the connector message) rather than through the merged connector message.Fix
In
Message.getMergedConnectorMessage(), populatechannelNameon the merged connector message:Message's ownchannelNamefield, andchannelName, which is reliably set during processing (see theConnectorMessageconstruction inChannel).The fallback matters because the
Messagecreated during processing does not always carrychannelName, while the source connector message does.Tests
Added
MessageTestcovering three cases:channelNamefrom the source connector message.Message-levelchannelNamewhen set.channelNamestaysnullwhen unavailable, so the fix does not fabricate a value.Verified with
./gradlew :donkey:test: 21 tests pass, 0 failures (MessageTest3,StatisticsTest9,JdbcDaoTest8,ChannelTest1).