简体   繁体   English

源 Javascript 阅读器中的欢乐频道地图未定义错误

[英]Mirth Channel Map Not Defined Error In Source Javascript Reader

I am using $c variables for db connectivity[i declared those variables in preprocessor script] in javascript reader as a source even I used channel map variables I am getting channel map not found error... Tried&Failed cases: 1.Added code template Lib[In Lib declared one function for db conn using those two channel map variables as parameters].我在 javascript 阅读器中使用 $c 变量进行 db 连接[我在预处理器脚本中声明了这些变量] 作为源,即使我使用了通道映射变量我得到通道映射未找到错误...尝试和失败的案例:1.添加了代码模板库[在 Lib 中使用这两个通道映射变量作为参数为 db conn 声明了一个函数]。 2.used those $c variables and called function as one of step in transformer and returned the db conn variable name. 2.使用这些 $c 变量并调用函数作为转换器中的步骤之一并返回 db conn 变量名称。 3.used $c variables and called function in deploy script as global map variables as well 4. declared like channelMap.put(dbconn,Dbconn); 3. 使用 $c 变量并在部署脚本中调用函数作为全局映射变量 4. 声明如 channelMap.put(dbconn,Dbconn); in source js reader Expected result: Source connector should connect to the db and read the data and return msg.在源 js 阅读器中预期结果:源连接器应连接到数据库并读取数据并返回 msg。

FYI: only for db connectivity I declared function and $c variables仅供参考:仅用于数据库连接我声明了函数和 $c 变量

The channelMap doesn't exist in a Javascript Reader because that is a message specific map, and in a JS Reader context, you are creating messages that don't yet exist. Javascript Reader 中不存在 channelMap,因为它是特定于消息的映射,而在 JS Reader 上下文中,您正在创建尚不存在的消息。

A preferred solution would be to use a different Map.首选的解决方案是使用不同的 Map。 The configurationMap is designed for this. configurationMap 就是为此而设计的。 You edit it in the server settings, and it is read-only in your channel.您在服务器设置中编辑它,它在您的频道中是只读的。

Another solution that is completely contained within the channel is to use the globalChannelMap.另一个完全包含在通道中的解决方案是使用 globalChannelMap。 That will allow you to set the value once in the deploy script, and access as needed.这将允许您在部署脚本中设置一次值,并根据需要进行访问。

If you need to set the value using information that is only available in the JS Reader, you need to return your messages as RawMessages rather than strings, and you can place values into the sourceMap at the time you are creating the RawMessages.如果您需要使用仅在 JS Reader 中可用的信息设置值,则需要将消息作为 RawMessages 而不是字符串返回,并且您可以在创建 RawMessages 时将值放入 sourceMap。

See the official User Guide available on the mirth downloads page for more information about the different Maps and their intended purposes.有关不同地图及其预期用途的更多信息,请参阅 mirth 下载页面上提供的官方用户指南。 Also for allowed return values from a Javascript Reader.也用于允许来自 Javascript 阅读器的返回值。 See the User API javadoc for more information about creating RawMessages.有关创建 RawMessage 的更多信息,请参阅 User API javadoc。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM